@servicetitan/eslint-plugin-folder-schema 30.3.1 → 31.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,46 +1,72 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get // eslint-disable-next-line import/no-default-export
13
+ default () {
14
+ return _default;
15
+ },
16
+ get rules () {
17
+ return rules;
7
18
  }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
19
  });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
20
+ const _folderlint = /*#__PURE__*/ _interop_require_wildcard(require("@servicetitan/folder-lint"));
21
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
22
+ const _memoize = /*#__PURE__*/ _interop_require_default(require("lodash/memoize"));
23
+ function _interop_require_default(obj) {
24
+ return obj && obj.__esModule ? obj : {
25
+ default: obj
26
26
  };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
27
+ }
28
+ function _getRequireWildcardCache(nodeInterop) {
29
+ if (typeof WeakMap !== "function") return null;
30
+ var cacheBabelInterop = new WeakMap();
31
+ var cacheNodeInterop = new WeakMap();
32
+ return (_getRequireWildcardCache = function(nodeInterop) {
33
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
34
+ })(nodeInterop);
35
+ }
36
+ function _interop_require_wildcard(obj, nodeInterop) {
37
+ if (!nodeInterop && obj && obj.__esModule) {
38
+ return obj;
39
+ }
40
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
41
+ return {
42
+ default: obj
43
+ };
44
+ }
45
+ var cache = _getRequireWildcardCache(nodeInterop);
46
+ if (cache && cache.has(obj)) {
47
+ return cache.get(obj);
48
+ }
49
+ var newObj = {
50
+ __proto__: null
33
51
  };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.rules = void 0;
40
- const FolderLint = __importStar(require("@servicetitan/folder-lint"));
41
- const path_1 = __importDefault(require("path"));
42
- const memoize_1 = __importDefault(require("lodash/memoize"));
43
- const checkPath = (0, memoize_1.default)((configPath) => FolderLint.checkPath(require(configPath).default));
52
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
53
+ for(var key in obj){
54
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
55
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
56
+ if (desc && (desc.get || desc.set)) {
57
+ Object.defineProperty(newObj, key, desc);
58
+ } else {
59
+ newObj[key] = obj[key];
60
+ }
61
+ }
62
+ }
63
+ newObj.default = obj;
64
+ if (cache) {
65
+ cache.set(obj, newObj);
66
+ }
67
+ return newObj;
68
+ }
69
+ const checkPath = (0, _memoize.default)((configPath)=>_folderlint.checkPath(require(configPath).default));
44
70
  const check = {
45
71
  meta: {
46
72
  schema: {
@@ -50,47 +76,71 @@ const check = {
50
76
  contains: {
51
77
  type: 'object',
52
78
  properties: {
53
- root: { type: 'string' },
54
- config: { type: 'string' },
55
- docLink: { type: 'string' },
79
+ root: {
80
+ type: 'string'
81
+ },
82
+ config: {
83
+ type: 'string'
84
+ },
85
+ docLink: {
86
+ type: 'string'
87
+ }
56
88
  },
57
- required: ['root', 'config'],
58
- },
59
- },
89
+ required: [
90
+ 'root',
91
+ 'config'
92
+ ]
93
+ }
94
+ }
60
95
  },
61
- create(context) {
96
+ create (context) {
62
97
  const { config, root, docLink } = context.options[0];
63
- const pathToCheck = path_1.default.relative(root, context.getFilename());
64
- checkPath(config)(pathToCheck).forEach(failure => context.report({
65
- message: FolderLint.printFailure(failure) + printDetails(docLink),
66
- loc: {
67
- start: { line: 0, column: 0 },
68
- end: { line: 0, column: 0 },
69
- },
70
- }));
98
+ const pathToCheck = _path.default.relative(root, context.getFilename());
99
+ checkPath(config)(pathToCheck).forEach((failure)=>context.report({
100
+ message: _folderlint.printFailure(failure) + printDetails(docLink),
101
+ loc: {
102
+ start: {
103
+ line: 0,
104
+ column: 0
105
+ },
106
+ end: {
107
+ line: 0,
108
+ column: 0
109
+ }
110
+ }
111
+ }));
71
112
  return {};
72
- },
113
+ }
73
114
  };
74
115
  function printDetails(docLink) {
75
116
  return docLink ? ' More details: ' + docLink : '';
76
117
  }
77
- exports.rules = {
78
- check,
118
+ const rules = {
119
+ check
79
120
  };
80
121
  const plugin = {
81
122
  configs: {
82
- recommended: ({ config, docLink = 'https://docs.st.dev/docs/frontend/file-structure', root = process.cwd(), }) => [
83
- {
84
- plugins: {
85
- '@servicetitan/folder-schema': { rules: exports.rules },
86
- },
87
- rules: {
88
- '@servicetitan/folder-schema/check': ['error', { root, config, docLink }],
89
- },
90
- },
91
- ],
92
- },
123
+ recommended: ({ config, docLink = 'https://docs.st.dev/docs/frontend/file-structure', root = process.cwd() })=>[
124
+ {
125
+ plugins: {
126
+ '@servicetitan/folder-schema': {
127
+ rules
128
+ }
129
+ },
130
+ rules: {
131
+ '@servicetitan/folder-schema/check': [
132
+ 'error',
133
+ {
134
+ root,
135
+ config,
136
+ docLink
137
+ }
138
+ ]
139
+ }
140
+ }
141
+ ]
142
+ }
93
143
  };
94
- // eslint-disable-next-line import/no-default-export
95
- exports.default = plugin;
144
+ const _default = plugin;
145
+
96
146
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sEAAwD;AACxD,gDAAwB;AAExB,6DAAqC;AAErC,MAAM,SAAS,GAAG,IAAA,iBAAO,EAAC,CAAC,UAAkB,EAAE,EAAE,CAC7C,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CACpD,CAAC;AAQF,MAAM,KAAK,GAAoB;IAC3B,IAAI,EAAE;QACF,MAAM,EAAE;YACJ,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACxB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC1B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBAC9B;gBACD,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;aAC/B;SACJ;KACJ;IACD,MAAM,CAAC,OAAkD;QACrD,MAAM,EAAE,MAA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
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Config } from '@eslint/config-helpers';\nimport * as FolderLint from '@servicetitan/folder-lint';\nimport path from 'path';\nimport { Rule } from 'eslint';\nimport memoize from 'lodash/memoize';\n\nconst checkPath = memoize((configPath: string) =>\n FolderLint.checkPath(require(configPath).default)\n);\n\ninterface Options {\n config: string;\n docLink?: string;\n root: string;\n}\n\nconst check: Rule.RuleModule = {\n meta: {\n schema: {\n type: 'array',\n minItems: 1,\n maxItems: 1,\n contains: {\n type: 'object',\n properties: {\n root: { type: 'string' },\n config: { type: 'string' },\n docLink: { type: 'string' },\n },\n required: ['root', 'config'],\n },\n },\n },\n create(context: Rule.RuleContext & { options: Options[] }) {\n const { config, root, docLink } = context.options[0];\n\n const pathToCheck = path.relative(root, context.getFilename());\n\n checkPath(config)(pathToCheck).forEach(failure =>\n context.report({\n message: FolderLint.printFailure(failure) + printDetails(docLink),\n loc: {\n start: { line: 0, column: 0 },\n end: { line: 0, column: 0 },\n },\n })\n );\n\n return {};\n },\n};\n\nfunction printDetails(docLink?: string): string {\n return docLink ? ' More details: ' + docLink : '';\n}\n\nexport const rules = {\n check,\n};\n\nconst plugin = {\n configs: {\n recommended: ({\n config,\n docLink = 'https://docs.st.dev/docs/frontend/file-structure',\n root = process.cwd(),\n }: {\n config: string;\n docLink?: string;\n root?: string;\n }): Config[] => [\n {\n plugins: {\n '@servicetitan/folder-schema': { rules },\n },\n rules: {\n '@servicetitan/folder-schema/check': ['error', { root, config, docLink }],\n },\n },\n ],\n },\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default plugin;\n"],"names":["rules","checkPath","memoize","configPath","FolderLint","require","default","check","meta","schema","type","minItems","maxItems","contains","properties","root","config","docLink","required","create","context","options","pathToCheck","path","relative","getFilename","forEach","failure","report","message","printFailure","printDetails","loc","start","line","column","end","plugin","configs","recommended","process","cwd","plugins"],"mappings":";;;;;;;;;;;QAmFA,oDAAoD;IACpD;eAAA;;QA5BaA;eAAAA;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;oBACAA,OAAO;wBACH,qCAAqC;4BAAC;4BAAS;gCAAEe;gCAAMC;gCAAQC;4BAAQ;yBAAE;oBAC7E;gBACJ;aACH;IACL;AACJ;MAGA,WAAeoB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/eslint-plugin-folder-schema",
3
- "version": "30.3.1",
3
+ "version": "31.0.0",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/folder-schema",
6
6
  "repository": {
@@ -15,17 +15,17 @@
15
15
  "src"
16
16
  ],
17
17
  "dependencies": {
18
- "@servicetitan/folder-lint": "30.3.1",
18
+ "@servicetitan/folder-lint": "31.0.0",
19
19
  "lodash": "~4.17.21"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/eslint": "~9.6.1",
23
23
  "@types/lodash": "~4.14.178",
24
- "eslint": "~9.27.0"
24
+ "eslint": "~9.30.1"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@eslint/config-helpers": "*",
28
- "eslint": "~9.27.0"
28
+ "eslint": "~9.30.1"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"
@@ -33,5 +33,5 @@
33
33
  "cli": {
34
34
  "webpack": false
35
35
  },
36
- "gitHead": "4d7f01d86d64fc00160d63a2e2a3448f28aa7a2d"
36
+ "gitHead": "c52e188a1217df74052774a2eea6a5126089e3d5"
37
37
  }