@servicetitan/eslint-plugin-folder-schema 28.5.0 → 30.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.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/src/index.ts +35 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { Config } from '@eslint/config-helpers';
|
|
1
2
|
import { Rule } from 'eslint';
|
|
2
3
|
export declare const rules: {
|
|
3
4
|
check: Rule.RuleModule;
|
|
4
5
|
};
|
|
6
|
+
declare const plugin: {
|
|
7
|
+
configs: {
|
|
8
|
+
recommended: ({ config, docLink, root, }: {
|
|
9
|
+
config: string;
|
|
10
|
+
docLink?: string;
|
|
11
|
+
root?: string;
|
|
12
|
+
}) => Config[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default plugin;
|
|
5
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAqD9B,eAAO,MAAM,KAAK;;CAEjB,CAAC;AAEF,QAAA,MAAM,MAAM;;kDAMD;YACC,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,IAAI,CAAC,EAAE,MAAM,CAAC;SACjB,KAAG,MAAM,EAAE;;CAWnB,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -37,9 +37,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.rules = void 0;
|
|
40
|
+
const FolderLint = __importStar(require("@servicetitan/folder-lint"));
|
|
40
41
|
const path_1 = __importDefault(require("path"));
|
|
41
42
|
const memoize_1 = __importDefault(require("lodash/memoize"));
|
|
42
|
-
const FolderLint = __importStar(require("@servicetitan/folder-lint"));
|
|
43
43
|
const checkPath = (0, memoize_1.default)((configPath) => FolderLint.checkPath(require(configPath).default));
|
|
44
44
|
const check = {
|
|
45
45
|
meta: {
|
|
@@ -77,4 +77,20 @@ function printDetails(docLink) {
|
|
|
77
77
|
exports.rules = {
|
|
78
78
|
check,
|
|
79
79
|
};
|
|
80
|
+
const plugin = {
|
|
81
|
+
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
|
+
},
|
|
93
|
+
};
|
|
94
|
+
// eslint-disable-next-line import/no-default-export
|
|
95
|
+
exports.default = plugin;
|
|
80
96
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sEAAwD;AACxD,gDAAwB;AAExB,6DAAqC;AAErC,MA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AC;AAEF,SAAS,YAAY,CAAC,OAAgB;IAClC,OAAO,OAAO,CAAC,CAAC,CAAC,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;AACtD,CAAC;AAEY,QAAA,KAAK,GAAG;IACjB,KAAK;CACR,CAAC;AAEF,MAAM,MAAM,GAAG;IACX,OAAO,EAAE;QACL,WAAW,EAAE,CAAC,EACV,MAAM,EACN,OAAO,GAAG,kDAAkD,EAC5D,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,GAKvB,EAAY,EAAE,CAAC;YACZ;gBACI,OAAO,EAAE;oBACL,6BAA6B,EAAE,EAAE,KAAK,EAAL,aAAK,EAAE;iBAC3C;gBACD,KAAK,EAAE;oBACH,mCAAmC,EAAE,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;iBAC5E;aACJ;SACJ;KACJ;CACJ,CAAC;AAEF,oDAAoD;AACpD,kBAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/eslint-plugin-folder-schema",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "30.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/folder-schema",
|
|
6
6
|
"repository": {
|
|
@@ -15,16 +15,17 @@
|
|
|
15
15
|
"src"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@servicetitan/folder-lint": "
|
|
18
|
+
"@servicetitan/folder-lint": "30.0.0",
|
|
19
19
|
"lodash": "~4.17.21"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/eslint": "~
|
|
22
|
+
"@types/eslint": "~9.6.1",
|
|
23
23
|
"@types/lodash": "~4.14.178",
|
|
24
|
-
"eslint": "~
|
|
24
|
+
"eslint": "~9.23.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"eslint": "
|
|
27
|
+
"@eslint/config-helpers": "*",
|
|
28
|
+
"eslint": "~9.23.0"
|
|
28
29
|
},
|
|
29
30
|
"publishConfig": {
|
|
30
31
|
"access": "public"
|
|
@@ -32,5 +33,5 @@
|
|
|
32
33
|
"cli": {
|
|
33
34
|
"webpack": false
|
|
34
35
|
},
|
|
35
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "e182cbb85cf66d62f235a9ca172fc04dc705fd0a"
|
|
36
37
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { Config } from '@eslint/config-helpers';
|
|
2
|
+
import * as FolderLint from '@servicetitan/folder-lint';
|
|
1
3
|
import path from 'path';
|
|
2
|
-
|
|
3
4
|
import { Rule } from 'eslint';
|
|
4
|
-
|
|
5
5
|
import memoize from 'lodash/memoize';
|
|
6
6
|
|
|
7
|
-
import * as FolderLint from '@servicetitan/folder-lint';
|
|
8
|
-
|
|
9
7
|
const checkPath = memoize((configPath: string) =>
|
|
10
8
|
FolderLint.checkPath(require(configPath).default)
|
|
11
9
|
);
|
|
12
10
|
|
|
11
|
+
interface Options {
|
|
12
|
+
config: string;
|
|
13
|
+
docLink?: string;
|
|
14
|
+
root: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
const check: Rule.RuleModule = {
|
|
14
18
|
meta: {
|
|
15
19
|
schema: {
|
|
@@ -27,7 +31,7 @@ const check: Rule.RuleModule = {
|
|
|
27
31
|
},
|
|
28
32
|
},
|
|
29
33
|
},
|
|
30
|
-
create(context) {
|
|
34
|
+
create(context: Rule.RuleContext & { options: Options[] }) {
|
|
31
35
|
const { config, root, docLink } = context.options[0];
|
|
32
36
|
|
|
33
37
|
const pathToCheck = path.relative(root, context.getFilename());
|
|
@@ -53,3 +57,29 @@ function printDetails(docLink?: string): string {
|
|
|
53
57
|
export const rules = {
|
|
54
58
|
check,
|
|
55
59
|
};
|
|
60
|
+
|
|
61
|
+
const plugin = {
|
|
62
|
+
configs: {
|
|
63
|
+
recommended: ({
|
|
64
|
+
config,
|
|
65
|
+
docLink = 'https://docs.st.dev/docs/frontend/file-structure',
|
|
66
|
+
root = process.cwd(),
|
|
67
|
+
}: {
|
|
68
|
+
config: string;
|
|
69
|
+
docLink?: string;
|
|
70
|
+
root?: string;
|
|
71
|
+
}): Config[] => [
|
|
72
|
+
{
|
|
73
|
+
plugins: {
|
|
74
|
+
'@servicetitan/folder-schema': { rules },
|
|
75
|
+
},
|
|
76
|
+
rules: {
|
|
77
|
+
'@servicetitan/folder-schema/check': ['error', { root, config, docLink }],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// eslint-disable-next-line import/no-default-export
|
|
85
|
+
export default plugin;
|