eslint-config-typed 3.5.2 → 3.6.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/configs/browser.mjs +1 -0
- package/dist/configs/browser.mjs.map +1 -1
- package/dist/configs/cypress.mjs +1 -0
- package/dist/configs/cypress.mjs.map +1 -1
- package/dist/configs/jest.mjs +1 -0
- package/dist/configs/jest.mjs.map +1 -1
- package/dist/configs/nodejs.mjs +1 -0
- package/dist/configs/nodejs.mjs.map +1 -1
- package/dist/configs/playwright.mjs +1 -0
- package/dist/configs/playwright.mjs.map +1 -1
- package/dist/configs/plugins.d.mts.map +1 -1
- package/dist/configs/plugins.mjs +1 -0
- package/dist/configs/plugins.mjs.map +1 -1
- package/dist/configs/react-base.mjs +1 -0
- package/dist/configs/react-base.mjs.map +1 -1
- package/dist/configs/testing-library.mjs +1 -0
- package/dist/configs/testing-library.mjs.map +1 -1
- package/dist/configs/vitest.mjs +1 -0
- package/dist/configs/vitest.mjs.map +1 -1
- package/dist/entry-point.mjs +1 -0
- package/dist/entry-point.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/component-name.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/component-name.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/import-style.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/import-style.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/shared.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/shared.mjs.map +1 -1
- package/dist/plugins/strict-dependencies/rules/resolve-import-path.d.mts.map +1 -1
- package/dist/plugins/strict-dependencies/rules/resolve-import-path.mjs.map +1 -1
- package/dist/plugins/strict-dependencies/rules/strict-dependencies.d.mts.map +1 -1
- package/dist/plugins/strict-dependencies/rules/strict-dependencies.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-hidden-type-assertions.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-hidden-type-assertions.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-nested-fp-ts-effects.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-nested-fp-ts-effects.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-division.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-division.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-url-constructor.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-url-constructor.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-premature-fp-ts-effects.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-premature-fp-ts-effects.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-mutable-readonly-assignment.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-mutable-readonly-assignment.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-readonly-mutable-assignment.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-readonly-mutable-assignment.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/require-strict-mode.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/require-strict-mode.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/unsafe-assignment-rule.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/unsafe-assignment-rule.mjs.map +1 -1
- package/dist/plugins/tree-shakable/rules/import-star.mjs.map +1 -1
- package/dist/rules/eslint-import-rules.mjs +1 -1
- package/dist/rules/eslint-import-rules.mjs.map +1 -1
- package/dist/rules/eslint-stylistic-rules.d.mts +17 -1
- package/dist/rules/eslint-stylistic-rules.d.mts.map +1 -1
- package/dist/rules/eslint-stylistic-rules.mjs +27 -1
- package/dist/rules/eslint-stylistic-rules.mjs.map +1 -1
- package/dist/types/flat-config.d.mts.map +1 -1
- package/package.json +1 -1
- package/src/configs/plugins.mts +1 -0
- package/src/plugins/react-coding-style/rules/component-name.mts +1 -0
- package/src/plugins/react-coding-style/rules/import-style.mts +1 -0
- package/src/plugins/react-coding-style/rules/react-memo-props-argument-name.mts +1 -0
- package/src/plugins/react-coding-style/rules/react-memo-type-parameter.mts +4 -0
- package/src/plugins/react-coding-style/rules/shared.mts +1 -0
- package/src/plugins/strict-dependencies/rules/resolve-import-path.mts +2 -0
- package/src/plugins/strict-dependencies/rules/resolve-import-path.test.mts +6 -0
- package/src/plugins/strict-dependencies/rules/strict-dependencies.mts +4 -0
- package/src/plugins/strict-dependencies/rules/strict-dependencies.test.mts +2 -0
- package/src/plugins/total-functions/rules/no-hidden-type-assertions.mts +3 -0
- package/src/plugins/total-functions/rules/no-nested-fp-ts-effects.mts +1 -0
- package/src/plugins/total-functions/rules/no-partial-division.mts +3 -0
- package/src/plugins/total-functions/rules/no-partial-url-constructor.mts +4 -0
- package/src/plugins/total-functions/rules/no-premature-fp-ts-effects.mts +1 -0
- package/src/plugins/total-functions/rules/no-unsafe-mutable-readonly-assignment.mts +1 -0
- package/src/plugins/total-functions/rules/no-unsafe-readonly-mutable-assignment.mts +1 -0
- package/src/plugins/total-functions/rules/require-strict-mode.mts +1 -0
- package/src/plugins/total-functions/rules/unsafe-assignment-rule.mts +4 -0
- package/src/plugins/tree-shakable/rules/import-star.mts +8 -0
- package/src/rules/eslint-import-rules.mts +2 -2
- package/src/rules/eslint-stylistic-rules.mts +36 -2
- package/src/types/flat-config.mts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-import-rules.mjs","sources":["../../src/rules/eslint-import-rules.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGO,MAAM,kBAAkB,GAAG;;AAEhC,IAAA,wBAAwB,EAAE,KAAK;;AAG/B,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A;IAED,gBAAgB,EAAE,KAAK;;;;;;;;AAQvB,IAAA,+BAA+B,EAAE;QAC/B,OAAO;AACP,QAAA;AACE,YAAA,gBAAgB,EAAE,IAAI;AACtB,YAAA,KAAK,EAAE,CAAC;AACT,SAAA;AACF,KAAA;AAED,IAAA,gCAAgC,EAAE,KAAK;AACvC,IAAA,2BAA2B,EAAE,KAAK;AAClC,IAAA,+BAA+B,EAAE;QAC/B,OAAO;AACP,QAAA;AACE,YAAA,KAAK,EAAE;gBACL,UAAU;gBACV,8BAA8B;gBAC9B,UAAU;gBACV,YAAY;AACb,aAAA;AACF,SAAA;AACF,KAAA;AACD,IAAA,2BAA2B,EAAE,KAAK;AAElC;;;AAGG;AACH,IAAA,4BAA4B,EAAE,OAAO;AAErC,IAAA,0BAA0B,EAAE,KAAK;AACjC,IAAA,sCAAsC,EAAE,iBAAiB,CAAC,OAAO,CAAC;AAClE,IAAA,wBAAwB,EAAE,KAAK;AAE/B,IAAA,mCAAmC,EAAE,KAAK;AAE1C,IAAA,gCAAgC,EAAE,OAAO;;;AAKzC,IAAA,4BAA4B,EAAE,iBAAiB,CAAC,OAAO,CAAC;IACxD,kCAAkC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;;AAGtE,IAAA,wBAAwB,EAAE,CAAC;;;;;"}
|
|
@@ -93,7 +93,23 @@ export declare const eslintStylisticRules: {
|
|
|
93
93
|
readonly '@stylistic/line-comment-position': "off";
|
|
94
94
|
readonly '@stylistic/lines-between-class-members': "off";
|
|
95
95
|
readonly '@stylistic/multiline-comment-style': "off";
|
|
96
|
-
readonly '@stylistic/padding-line-between-statements': "off";
|
|
97
96
|
readonly '@stylistic/spaced-comment': "off";
|
|
97
|
+
readonly '@stylistic/padding-line-between-statements': readonly ["error", {
|
|
98
|
+
readonly blankLine: "never";
|
|
99
|
+
readonly prev: "import";
|
|
100
|
+
readonly next: "import";
|
|
101
|
+
}, {
|
|
102
|
+
readonly blankLine: "always";
|
|
103
|
+
readonly prev: "*";
|
|
104
|
+
readonly next: "return";
|
|
105
|
+
}, {
|
|
106
|
+
readonly blankLine: "always";
|
|
107
|
+
readonly prev: readonly ["for", "if", "switch", "default", "class", "while", "multiline-block-like", "multiline-expression", "multiline-const", "multiline-let", "multiline-return", "multiline-type", "multiline-using"];
|
|
108
|
+
readonly next: "*";
|
|
109
|
+
}, {
|
|
110
|
+
readonly blankLine: "always";
|
|
111
|
+
readonly prev: "*";
|
|
112
|
+
readonly next: readonly ["for", "if", "switch", "default", "class", "while", "multiline-block-like", "multiline-expression", "multiline-const", "multiline-let", "multiline-return", "multiline-type", "multiline-using"];
|
|
113
|
+
}];
|
|
98
114
|
};
|
|
99
115
|
//# sourceMappingURL=eslint-stylistic-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-stylistic-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-stylistic-rules.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eslint-stylistic-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-stylistic-rules.mts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqIQ,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { pipe } from 'ts-data-forge';
|
|
2
|
+
|
|
1
3
|
const eslintStylisticRules = {
|
|
2
4
|
// Rules explicitly disabled by eslint-config-prettier (special handling)
|
|
3
5
|
'@stylistic/lines-around-comment': 'off',
|
|
@@ -97,8 +99,32 @@ const eslintStylisticRules = {
|
|
|
97
99
|
'@stylistic/line-comment-position': 'off',
|
|
98
100
|
'@stylistic/lines-between-class-members': 'off',
|
|
99
101
|
'@stylistic/multiline-comment-style': 'off',
|
|
100
|
-
'@stylistic/padding-line-between-statements': 'off',
|
|
101
102
|
'@stylistic/spaced-comment': 'off',
|
|
103
|
+
'@stylistic/padding-line-between-statements': [
|
|
104
|
+
'error',
|
|
105
|
+
{ blankLine: 'never', prev: 'import', next: 'import' },
|
|
106
|
+
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
107
|
+
...pipe([
|
|
108
|
+
'for',
|
|
109
|
+
'if',
|
|
110
|
+
'switch',
|
|
111
|
+
// 'case', // This conflicts with no-fallthrough
|
|
112
|
+
'default',
|
|
113
|
+
'class',
|
|
114
|
+
'while',
|
|
115
|
+
'multiline-block-like',
|
|
116
|
+
'multiline-expression',
|
|
117
|
+
'multiline-const',
|
|
118
|
+
'multiline-let',
|
|
119
|
+
// 'multiline-var', // `var` is disallowed by "no-var" rule
|
|
120
|
+
'multiline-return',
|
|
121
|
+
'multiline-type',
|
|
122
|
+
'multiline-using',
|
|
123
|
+
]).map((keys) => [
|
|
124
|
+
{ blankLine: 'always', prev: keys, next: '*' },
|
|
125
|
+
{ blankLine: 'always', prev: '*', next: keys },
|
|
126
|
+
]).value,
|
|
127
|
+
],
|
|
102
128
|
};
|
|
103
129
|
|
|
104
130
|
export { eslintStylisticRules };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-stylistic-rules.mjs","sources":["../../src/rules/eslint-stylistic-rules.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eslint-stylistic-rules.mjs","sources":["../../src/rules/eslint-stylistic-rules.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAMO,MAAM,oBAAoB,GAAG;;AAElC,IAAA,iCAAiC,EAAE,KAAK;AACxC,IAAA,oBAAoB,EAAE,KAAK;AAC3B,IAAA,+BAA+B,EAAE,KAAK;AACtC,IAAA,+BAA+B,EAAE,KAAK;AACtC,IAAA,oBAAoB,EAAE,KAAK;AAC3B,IAAA,mBAAmB,EAAE,KAAK;;AAG1B,IAAA,kCAA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names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"flat-config.d.mts","sourceRoot":"","sources":["../../src/types/flat-config.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,UAAU,IAAI,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEpF,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,MAAM,IAAI,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAGhD,MAAM,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/configs/plugins.mts
CHANGED
|
@@ -48,6 +48,7 @@ export const reactMemoTypeParameterRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
48
48
|
node: castDeepMutable(node.callee),
|
|
49
49
|
messageId: 'requirePropsTypeParameter',
|
|
50
50
|
});
|
|
51
|
+
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -56,6 +57,7 @@ export const reactMemoTypeParameterRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
56
57
|
node: castDeepMutable(typeArguments),
|
|
57
58
|
messageId: 'omitTypeParameterWhenPropsEmpty',
|
|
58
59
|
});
|
|
60
|
+
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -64,6 +66,7 @@ export const reactMemoTypeParameterRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
64
66
|
node: castDeepMutable(typeArguments),
|
|
65
67
|
messageId: 'requirePropsTypeParameter',
|
|
66
68
|
});
|
|
69
|
+
|
|
67
70
|
return;
|
|
68
71
|
}
|
|
69
72
|
|
|
@@ -71,6 +74,7 @@ export const reactMemoTypeParameterRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
71
74
|
|
|
72
75
|
if (!isPropsTypeReference(firstParameter)) {
|
|
73
76
|
const reportTarget = firstParameter ?? node.callee;
|
|
77
|
+
|
|
74
78
|
context.report({
|
|
75
79
|
node: castDeepMutable(reportTarget),
|
|
76
80
|
messageId: 'requirePropsTypeParameter',
|
|
@@ -21,6 +21,7 @@ export const getReactMemoArrowFunction = (
|
|
|
21
21
|
node: DeepReadonly<TSESTree.CallExpression>,
|
|
22
22
|
): DeepReadonly<TSESTree.ArrowFunctionExpression> | undefined => {
|
|
23
23
|
const [firstArgument] = node.arguments;
|
|
24
|
+
|
|
24
25
|
if (firstArgument === undefined) {
|
|
25
26
|
return undefined;
|
|
26
27
|
}
|
|
@@ -27,6 +27,7 @@ export const resolveImportPath = (
|
|
|
27
27
|
const matchedKey: string | undefined = Object.keys(pathIndexMap).find(
|
|
28
28
|
(k) => k === key,
|
|
29
29
|
);
|
|
30
|
+
|
|
30
31
|
// MEMO: pathIndexMapの指定がない場合 or 指定されているindexにアクセスしても値が得られない場合は[0]固定
|
|
31
32
|
const pathIndex =
|
|
32
33
|
matchedKey !== undefined ? pathIndexMap[matchedKey] : 0;
|
|
@@ -71,6 +72,7 @@ const readTsConfig = (tsconfigPath: string): ts.CompilerOptions | undefined => {
|
|
|
71
72
|
const basePath = ts.sys.directoryExists(tsconfigPath)
|
|
72
73
|
? tsconfigPath
|
|
73
74
|
: path.dirname(tsconfigPath);
|
|
75
|
+
|
|
74
76
|
const found = ts.findConfigFile(
|
|
75
77
|
basePath,
|
|
76
78
|
(filePath) => ts.sys.fileExists(filePath),
|
|
@@ -19,9 +19,11 @@ vi.mock(import('typescript'), async () => {
|
|
|
19
19
|
const actual = await vi.importActual<TypeScriptModule>('typescript');
|
|
20
20
|
// eslint-disable-next-line functional/immutable-data
|
|
21
21
|
actualFunctions.findConfigFile = actual.findConfigFile;
|
|
22
|
+
|
|
22
23
|
// eslint-disable-next-line functional/immutable-data
|
|
23
24
|
actualFunctions.getParsedCommandLineOfConfigFile =
|
|
24
25
|
actual.getParsedCommandLineOfConfigFile;
|
|
26
|
+
|
|
25
27
|
return {
|
|
26
28
|
...actual,
|
|
27
29
|
findConfigFile: vi.fn(actual.findConfigFile),
|
|
@@ -100,6 +102,7 @@ const restoreActual = (): void => {
|
|
|
100
102
|
actualFunctions.getParsedCommandLineOfConfigFile !== undefined
|
|
101
103
|
) {
|
|
102
104
|
mockFindConfigFile.mockImplementation(actualFunctions.findConfigFile);
|
|
105
|
+
|
|
103
106
|
mockGetParsedCommandLine.mockImplementation(
|
|
104
107
|
actualFunctions.getParsedCommandLineOfConfigFile,
|
|
105
108
|
);
|
|
@@ -115,6 +118,7 @@ const useFixture = (fixtureName: FixtureName | undefined): void => {
|
|
|
115
118
|
|
|
116
119
|
const compilerOptions = compilerOptionsByFixture[fixtureName];
|
|
117
120
|
mockFindConfigFile.mockImplementation(() => 'tsconfig.json');
|
|
121
|
+
|
|
118
122
|
mockGetParsedCommandLine.mockImplementation(() => ({
|
|
119
123
|
options: { ...compilerOptions },
|
|
120
124
|
fileNames: [],
|
|
@@ -213,6 +217,7 @@ describe(resolveImportPath, () => {
|
|
|
213
217
|
expect(resolveImportPath('components/aaa/bbb', undefined, {})).toBe(
|
|
214
218
|
'components/aaa/bbb',
|
|
215
219
|
);
|
|
220
|
+
|
|
216
221
|
expect(resolveImportPath(importPath, undefined, {})).toBe(expected);
|
|
217
222
|
|
|
218
223
|
useFixture(undefined);
|
|
@@ -227,6 +232,7 @@ describe(resolveImportPath, () => {
|
|
|
227
232
|
expect(resolveImportPath('components/aaa/bbb', undefined, {})).toBe(
|
|
228
233
|
'components/aaa/bbb',
|
|
229
234
|
);
|
|
235
|
+
|
|
230
236
|
expect(resolveImportPath('@/components/aaa/bbb', undefined, {})).toBe(
|
|
231
237
|
expected,
|
|
232
238
|
);
|
|
@@ -105,9 +105,11 @@ export const strictDependenciesRule: TSESLint.RuleModule<
|
|
|
105
105
|
return {
|
|
106
106
|
ImportDeclaration: (node: DeepReadonly<TSESTree.ImportDeclaration>) => {
|
|
107
107
|
const fileFullPath = context.filename;
|
|
108
|
+
|
|
108
109
|
const relativeFilePath = path.normalize(
|
|
109
110
|
path.relative(process.cwd(), fileFullPath),
|
|
110
111
|
);
|
|
112
|
+
|
|
111
113
|
const importPath = resolveImportPath(
|
|
112
114
|
node.source.value,
|
|
113
115
|
resolveRelativeImport === true ? relativeFilePath : undefined,
|
|
@@ -157,6 +159,7 @@ export const strictDependenciesRule: TSESLint.RuleModule<
|
|
|
157
159
|
dependency.targetMembers,
|
|
158
160
|
importedModules,
|
|
159
161
|
);
|
|
162
|
+
|
|
160
163
|
if (commonImportedList.length > 0) {
|
|
161
164
|
context.report({
|
|
162
165
|
node: castDeepMutable(node),
|
|
@@ -167,6 +170,7 @@ export const strictDependenciesRule: TSESLint.RuleModule<
|
|
|
167
170
|
},
|
|
168
171
|
});
|
|
169
172
|
}
|
|
173
|
+
|
|
170
174
|
continue;
|
|
171
175
|
}
|
|
172
176
|
|
|
@@ -91,6 +91,7 @@ describe('strictDependencies Rule', () => {
|
|
|
91
91
|
|
|
92
92
|
expect(messages).toHaveLength(1);
|
|
93
93
|
expect(messages[0]?.messageId).toBe('forbidden-import');
|
|
94
|
+
|
|
94
95
|
expect(messages[0]?.message).toBe(
|
|
95
96
|
`import '${normalize('src/components/ui/Text')}' is not allowed from ${normalize('src/components/test/aaa.ts')}.`,
|
|
96
97
|
);
|
|
@@ -105,6 +106,7 @@ describe('strictDependencies Rule', () => {
|
|
|
105
106
|
|
|
106
107
|
expect(messages).toHaveLength(1);
|
|
107
108
|
expect(messages[0]?.messageId).toBe('forbidden-import-specifier');
|
|
109
|
+
|
|
108
110
|
expect(messages[0]?.message).toBe(
|
|
109
111
|
`import specifier 'Text' is not allowed from ${normalize('src/components/button.tsx')}.`,
|
|
110
112
|
);
|
|
@@ -107,6 +107,7 @@ export const noHiddenTypeAssertions = createRule({
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
const typeParameters = callSignature.declaration.typeParameters;
|
|
110
|
+
|
|
110
111
|
const parameters = parametersToTypeNodes(
|
|
111
112
|
callSignature.declaration.parameters,
|
|
112
113
|
0,
|
|
@@ -144,6 +145,7 @@ export const noHiddenTypeAssertions = createRule({
|
|
|
144
145
|
const allCorrespondingTypeArgumentsAreUnknownType =
|
|
145
146
|
typeParamsUsedInReturnType.every(({ index, typeParameter }) => {
|
|
146
147
|
const typeArgument = (tsExpressionNode.typeArguments ?? [])[index];
|
|
148
|
+
|
|
147
149
|
const typeArgumentType =
|
|
148
150
|
typeArgument !== undefined
|
|
149
151
|
? checker.getTypeAtLocation(typeArgument)
|
|
@@ -200,6 +202,7 @@ const hasTypeNode = (
|
|
|
200
202
|
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
201
203
|
const typeAttr = (typeElement as Partial<Readonly<{ type: TypeNode }>>)
|
|
202
204
|
.type;
|
|
205
|
+
|
|
203
206
|
return typeAttr !== undefined && isTypeNode(typeAttr);
|
|
204
207
|
} catch {
|
|
205
208
|
return false;
|
|
@@ -31,6 +31,7 @@ export const noPartialDivision = createRule({
|
|
|
31
31
|
const numberLiteralParts = intersectionTypeParts(type).filter(
|
|
32
32
|
(t) => isBigIntLiteral(t) || t.isNumberLiteral(),
|
|
33
33
|
);
|
|
34
|
+
|
|
34
35
|
return (
|
|
35
36
|
numberLiteralParts.length > 0 &&
|
|
36
37
|
numberLiteralParts.every((t) => isSafeDenominator(t))
|
|
@@ -67,6 +68,7 @@ export const noPartialDivision = createRule({
|
|
|
67
68
|
const denominatorNode = parserServices.esTreeNodeToTSNodeMap.get(
|
|
68
69
|
node.right,
|
|
69
70
|
);
|
|
71
|
+
|
|
70
72
|
const denominatorNodeType =
|
|
71
73
|
checker.getTypeAtLocation(denominatorNode);
|
|
72
74
|
|
|
@@ -95,6 +97,7 @@ const isPseudoBigInt = (val: unknown): val is PseudoBigInt => {
|
|
|
95
97
|
typeof val === 'object' && val !== null
|
|
96
98
|
? (val as Partial<PseudoBigInt>)
|
|
97
99
|
: undefined;
|
|
100
|
+
|
|
98
101
|
return (
|
|
99
102
|
valAsPseudoBigInt !== undefined &&
|
|
100
103
|
typeof valAsPseudoBigInt.base10Value === 'string' &&
|
|
@@ -32,6 +32,7 @@ export const noPartialUrlConstructor = createRule({
|
|
|
32
32
|
const objectNode = parserServices.esTreeNodeToTSNodeMap.get(
|
|
33
33
|
node.callee,
|
|
34
34
|
);
|
|
35
|
+
|
|
35
36
|
const objectType = checker.getTypeAtLocation(objectNode);
|
|
36
37
|
|
|
37
38
|
const prototype = checker.getPropertyOfType(objectType, 'prototype');
|
|
@@ -57,6 +58,7 @@ export const noPartialUrlConstructor = createRule({
|
|
|
57
58
|
messageId: 'errorStringWillDefinitelyThrow',
|
|
58
59
|
} as const);
|
|
59
60
|
}
|
|
61
|
+
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -75,6 +77,7 @@ export const noPartialUrlConstructor = createRule({
|
|
|
75
77
|
messageId: 'errorStringWillDefinitelyThrow',
|
|
76
78
|
} as const);
|
|
77
79
|
}
|
|
80
|
+
|
|
78
81
|
return;
|
|
79
82
|
}
|
|
80
83
|
|
|
@@ -93,6 +96,7 @@ const isValidUrl = (s: string, base?: string): boolean => {
|
|
|
93
96
|
try {
|
|
94
97
|
// eslint-disable-next-line no-new
|
|
95
98
|
new URL(s, base);
|
|
99
|
+
|
|
96
100
|
return true;
|
|
97
101
|
} catch {
|
|
98
102
|
return false;
|
|
@@ -128,6 +128,7 @@ export const createNoUnsafeAssignmentRule =
|
|
|
128
128
|
const leftTsNode = parserServices.esTreeNodeToTSNodeMap.get(
|
|
129
129
|
declaration.id,
|
|
130
130
|
);
|
|
131
|
+
|
|
131
132
|
const rightTsNode = parserServices.esTreeNodeToTSNodeMap.get(
|
|
132
133
|
declaration.init,
|
|
133
134
|
);
|
|
@@ -177,6 +178,7 @@ export const createNoUnsafeAssignmentRule =
|
|
|
177
178
|
|
|
178
179
|
AssignmentExpression: (node): void => {
|
|
179
180
|
const leftTsNode = parserServices.esTreeNodeToTSNodeMap.get(node.left);
|
|
181
|
+
|
|
180
182
|
const rightTsNode = parserServices.esTreeNodeToTSNodeMap.get(
|
|
181
183
|
node.right,
|
|
182
184
|
);
|
|
@@ -348,6 +350,7 @@ export const createNoUnsafeAssignmentRule =
|
|
|
348
350
|
const destinationNode = parserServices.esTreeNodeToTSNodeMap.get(
|
|
349
351
|
node.returnType.typeAnnotation,
|
|
350
352
|
);
|
|
353
|
+
|
|
351
354
|
const destinationType = checker.getTypeAtLocation(destinationNode);
|
|
352
355
|
const sourceNode = parserServices.esTreeNodeToTSNodeMap.get(node.body);
|
|
353
356
|
const sourceType = checker.getTypeAtLocation(sourceNode);
|
|
@@ -410,6 +413,7 @@ export const createNoUnsafeAssignmentRule =
|
|
|
410
413
|
|
|
411
414
|
// TODO handle spread elements
|
|
412
415
|
const rawArgument = node.arguments[i];
|
|
416
|
+
|
|
413
417
|
const argument =
|
|
414
418
|
rawArgument?.type === AST_NODE_TYPES.SpreadElement
|
|
415
419
|
? undefined
|
|
@@ -44,11 +44,14 @@ const checkModuleNamespaceUsage = (
|
|
|
44
44
|
const scope = context.sourceCode.getScope(node);
|
|
45
45
|
|
|
46
46
|
const variable = scope.set.get(identifier.name);
|
|
47
|
+
|
|
47
48
|
if (variable === undefined) {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
51
|
+
|
|
50
52
|
for (const ref of variable.references) {
|
|
51
53
|
const referencedIdentifier = ref.identifier;
|
|
54
|
+
|
|
52
55
|
if (!isTreeShakingSafeReference(referencedIdentifier)) {
|
|
53
56
|
context.report({
|
|
54
57
|
node: referencedIdentifier,
|
|
@@ -76,11 +79,14 @@ const isTreeShakingSafeReference = (
|
|
|
76
79
|
// id.foo
|
|
77
80
|
return true;
|
|
78
81
|
}
|
|
82
|
+
|
|
79
83
|
const memberName = parent.property;
|
|
84
|
+
|
|
80
85
|
if (memberName.type === TSESTree.AST_NODE_TYPES.Literal) {
|
|
81
86
|
// id["foo"]
|
|
82
87
|
return true;
|
|
83
88
|
}
|
|
89
|
+
|
|
84
90
|
return false;
|
|
85
91
|
}
|
|
86
92
|
|
|
@@ -93,10 +99,12 @@ const isTreeShakingSafeReference = (
|
|
|
93
99
|
// TypeScript's type
|
|
94
100
|
return true;
|
|
95
101
|
}
|
|
102
|
+
|
|
96
103
|
case TSESTree.AST_NODE_TYPES.TSTypeQuery: {
|
|
97
104
|
// 'typeof t' in TypeScript's type context
|
|
98
105
|
return true;
|
|
99
106
|
}
|
|
107
|
+
|
|
100
108
|
case TSESTree.AST_NODE_TYPES.AccessorProperty:
|
|
101
109
|
case TSESTree.AST_NODE_TYPES.ArrayExpression:
|
|
102
110
|
case TSESTree.AST_NODE_TYPES.ArrayPattern:
|
|
@@ -83,7 +83,7 @@ export const eslintImportsRules = {
|
|
|
83
83
|
},
|
|
84
84
|
],
|
|
85
85
|
|
|
86
|
-
'import-x/order': 'off', //
|
|
86
|
+
'import-x/order': 'off', // Covered by prettier-plugin-organize-imports
|
|
87
87
|
// 'import-x/order': [
|
|
88
88
|
// 'error',
|
|
89
89
|
// {
|
|
@@ -91,7 +91,6 @@ export const eslintImportsRules = {
|
|
|
91
91
|
// 'newlines-between': 'never',
|
|
92
92
|
// },
|
|
93
93
|
// ],
|
|
94
|
-
|
|
95
94
|
'import-x/newline-after-import': [
|
|
96
95
|
'error',
|
|
97
96
|
{
|
|
@@ -99,6 +98,7 @@ export const eslintImportsRules = {
|
|
|
99
98
|
count: 1,
|
|
100
99
|
},
|
|
101
100
|
],
|
|
101
|
+
|
|
102
102
|
'import-x/prefer-default-export': 'off',
|
|
103
103
|
'import-x/max-dependencies': 'off',
|
|
104
104
|
'import-x/no-unassigned-import': [
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { pipe } from 'ts-data-forge';
|
|
2
|
+
import {
|
|
3
|
+
type EslintStylisticRules,
|
|
4
|
+
type EslintStylisticRulesOption,
|
|
5
|
+
} from '../types/index.mjs';
|
|
2
6
|
|
|
3
7
|
export const eslintStylisticRules = {
|
|
4
8
|
// Rules explicitly disabled by eslint-config-prettier (special handling)
|
|
@@ -92,6 +96,7 @@ export const eslintStylisticRules = {
|
|
|
92
96
|
// Additional stylistic rules defaulted to off
|
|
93
97
|
'@stylistic/curly-newline': 'off',
|
|
94
98
|
'@stylistic/exp-list-style': 'off',
|
|
99
|
+
|
|
95
100
|
// Covered by react/jsx-curly-brace-presence
|
|
96
101
|
'@stylistic/jsx-curly-brace-presence': 'off',
|
|
97
102
|
'@stylistic/jsx-function-call-newline': 'off',
|
|
@@ -101,6 +106,35 @@ export const eslintStylisticRules = {
|
|
|
101
106
|
'@stylistic/line-comment-position': 'off',
|
|
102
107
|
'@stylistic/lines-between-class-members': 'off',
|
|
103
108
|
'@stylistic/multiline-comment-style': 'off',
|
|
104
|
-
'@stylistic/padding-line-between-statements': 'off',
|
|
105
109
|
'@stylistic/spaced-comment': 'off',
|
|
110
|
+
|
|
111
|
+
'@stylistic/padding-line-between-statements': [
|
|
112
|
+
'error',
|
|
113
|
+
{ blankLine: 'never', prev: 'import', next: 'import' },
|
|
114
|
+
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
115
|
+
|
|
116
|
+
...pipe([
|
|
117
|
+
'for',
|
|
118
|
+
'if',
|
|
119
|
+
'switch',
|
|
120
|
+
// 'case', // This conflicts with no-fallthrough
|
|
121
|
+
'default',
|
|
122
|
+
'class',
|
|
123
|
+
'while',
|
|
124
|
+
'multiline-block-like',
|
|
125
|
+
'multiline-expression',
|
|
126
|
+
'multiline-const',
|
|
127
|
+
'multiline-let',
|
|
128
|
+
// 'multiline-var', // `var` is disallowed by "no-var" rule
|
|
129
|
+
'multiline-return',
|
|
130
|
+
'multiline-type',
|
|
131
|
+
'multiline-using',
|
|
132
|
+
] as const satisfies EslintStylisticRulesOption['@stylistic/padding-line-between-statements'][0]['next']).map(
|
|
133
|
+
(keys) =>
|
|
134
|
+
[
|
|
135
|
+
{ blankLine: 'always', prev: keys, next: '*' },
|
|
136
|
+
{ blankLine: 'always', prev: '*', next: keys },
|
|
137
|
+
] as const,
|
|
138
|
+
).value,
|
|
139
|
+
],
|
|
106
140
|
} as const satisfies EslintStylisticRules;
|