@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 +119 -69
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,46 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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: {
|
|
54
|
-
|
|
55
|
-
|
|
79
|
+
root: {
|
|
80
|
+
type: 'string'
|
|
81
|
+
},
|
|
82
|
+
config: {
|
|
83
|
+
type: 'string'
|
|
84
|
+
},
|
|
85
|
+
docLink: {
|
|
86
|
+
type: 'string'
|
|
87
|
+
}
|
|
56
88
|
},
|
|
57
|
-
required: [
|
|
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 =
|
|
64
|
-
checkPath(config)(pathToCheck).forEach(failure
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
95
|
-
|
|
144
|
+
const _default = plugin;
|
|
145
|
+
|
|
96
146
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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;;;oEAvDe;6DACX;gEAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpB,MAAMC,YAAYC,IA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;IACL;AACJ;MAGA,WAAeoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/eslint-plugin-folder-schema",
|
|
3
|
-
"version": "
|
|
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": "
|
|
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.
|
|
24
|
+
"eslint": "~9.30.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@eslint/config-helpers": "*",
|
|
28
|
-
"eslint": "~9.
|
|
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": "
|
|
36
|
+
"gitHead": "c52e188a1217df74052774a2eea6a5126089e3d5"
|
|
37
37
|
}
|