Skip to content

Commit aca3051

Browse files
committedSep 19, 2023
fix: tsconfig lint not enabled
1 parent 96e547a commit aca3051

File tree

1 file changed

+129
-124
lines changed

1 file changed

+129
-124
lines changed
 

‎packages/eslint-config-ts/index.js

+129-124
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,132 @@ module.exports = {
1919
node: { extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.d.ts'] },
2020
},
2121
},
22-
overrides: basic.overrides.concat(
23-
!fs.existsSync(join(process.cwd(), tsconfig))
22+
overrides: [
23+
...basic.overrides,
24+
// TSConfig Sorting
25+
{
26+
files: ['**/tsconfig.json', '**/tsconfig.*.json'],
27+
parser: 'jsonc-eslint-parser',
28+
rules: {
29+
'jsonc/sort-keys': [
30+
'error',
31+
{
32+
pathPattern: '^$',
33+
order: [
34+
'extends',
35+
'compilerOptions',
36+
'references',
37+
'files',
38+
'include',
39+
'exclude',
40+
],
41+
},
42+
{
43+
pathPattern: '^compilerOptions$',
44+
order: [
45+
/* Projects */
46+
'incremental',
47+
'composite',
48+
'tsBuildInfoFile',
49+
'disableSourceOfProjectReferenceRedirect',
50+
'disableSolutionSearching',
51+
'disableReferencedProjectLoad',
52+
/* Language and Environment */
53+
'target',
54+
'lib',
55+
'jsx',
56+
'experimentalDecorators',
57+
'emitDecoratorMetadata',
58+
'jsxFactory',
59+
'jsxFragmentFactory',
60+
'jsxImportSource',
61+
'reactNamespace',
62+
'noLib',
63+
'useDefineForClassFields',
64+
'moduleDetection',
65+
/* Modules */
66+
'module',
67+
'rootDir',
68+
'moduleResolution',
69+
'baseUrl',
70+
'paths',
71+
'rootDirs',
72+
'typeRoots',
73+
'types',
74+
'allowUmdGlobalAccess',
75+
'moduleSuffixes',
76+
'allowImportingTsExtensions',
77+
'resolvePackageJsonExports',
78+
'resolvePackageJsonImports',
79+
'customConditions',
80+
'resolveJsonModule',
81+
'allowArbitraryExtensions',
82+
'noResolve',
83+
/* JavaScript Support */
84+
'allowJs',
85+
'checkJs',
86+
'maxNodeModuleJsDepth',
87+
/* Emit */
88+
'declaration',
89+
'declarationMap',
90+
'emitDeclarationOnly',
91+
'sourceMap',
92+
'inlineSourceMap',
93+
'outFile',
94+
'outDir',
95+
'removeComments',
96+
'noEmit',
97+
'importHelpers',
98+
'importsNotUsedAsValues',
99+
'downlevelIteration',
100+
'sourceRoot',
101+
'mapRoot',
102+
'inlineSources',
103+
'emitBOM',
104+
'newLine',
105+
'stripInternal',
106+
'noEmitHelpers',
107+
'noEmitOnError',
108+
'preserveConstEnums',
109+
'declarationDir',
110+
'preserveValueImports',
111+
/* Interop Constraints */
112+
'isolatedModules',
113+
'verbatimModuleSyntax',
114+
'allowSyntheticDefaultImports',
115+
'esModuleInterop',
116+
'preserveSymlinks',
117+
'forceConsistentCasingInFileNames',
118+
/* Type Checking */
119+
'strict',
120+
'strictBindCallApply',
121+
'strictFunctionTypes',
122+
'strictNullChecks',
123+
'strictPropertyInitialization',
124+
'allowUnreachableCode',
125+
'allowUnusedLabels',
126+
'alwaysStrict',
127+
'exactOptionalPropertyTypes',
128+
'noFallthroughCasesInSwitch',
129+
'noImplicitAny',
130+
'noImplicitOverride',
131+
'noImplicitReturns',
132+
'noImplicitThis',
133+
'noPropertyAccessFromIndexSignature',
134+
'noUncheckedIndexedAccess',
135+
'noUnusedLocals',
136+
'noUnusedParameters',
137+
'useUnknownInCatchVariables',
138+
/* Completeness */
139+
'skipDefaultLibCheck',
140+
'skipLibCheck',
141+
],
142+
},
143+
],
144+
},
145+
},
146+
// TS Aware Rules
147+
...(!fs.existsSync(join(process.cwd(), tsconfig))
24148
? []
25149
: [{
26150
parserOptions: {
@@ -63,128 +187,9 @@ module.exports = {
63187
'@typescript-eslint/unbound-method': 'off',
64188
'jest/unbound-method': 'error',
65189
},
66-
}, {
67-
files: ['tsconfig.json', 'tsconfig.*.json'],
68-
parser: 'jsonc-eslint-parser',
69-
rules: {
70-
'jsonc/sort-keys': [
71-
'error',
72-
{
73-
pathPattern: '^$',
74-
order: [
75-
'extends',
76-
'compilerOptions',
77-
'references',
78-
'files',
79-
'include',
80-
'exclude',
81-
],
82-
},
83-
{
84-
pathPattern: '^compilerOptions$',
85-
order: [
86-
/* Projects */
87-
'incremental',
88-
'composite',
89-
'tsBuildInfoFile',
90-
'disableSourceOfProjectReferenceRedirect',
91-
'disableSolutionSearching',
92-
'disableReferencedProjectLoad',
93-
/* Language and Environment */
94-
'target',
95-
'lib',
96-
'jsx',
97-
'experimentalDecorators',
98-
'emitDecoratorMetadata',
99-
'jsxFactory',
100-
'jsxFragmentFactory',
101-
'jsxImportSource',
102-
'reactNamespace',
103-
'noLib',
104-
'useDefineForClassFields',
105-
'moduleDetection',
106-
/* Modules */
107-
'module',
108-
'rootDir',
109-
'moduleResolution',
110-
'baseUrl',
111-
'paths',
112-
'rootDirs',
113-
'typeRoots',
114-
'types',
115-
'allowUmdGlobalAccess',
116-
'moduleSuffixes',
117-
'allowImportingTsExtensions',
118-
'resolvePackageJsonExports',
119-
'resolvePackageJsonImports',
120-
'customConditions',
121-
'resolveJsonModule',
122-
'allowArbitraryExtensions',
123-
'noResolve',
124-
/* JavaScript Support */
125-
'allowJs',
126-
'checkJs',
127-
'maxNodeModuleJsDepth',
128-
/* Emit */
129-
'declaration',
130-
'declarationMap',
131-
'emitDeclarationOnly',
132-
'sourceMap',
133-
'inlineSourceMap',
134-
'outFile',
135-
'outDir',
136-
'removeComments',
137-
'noEmit',
138-
'importHelpers',
139-
'importsNotUsedAsValues',
140-
'downlevelIteration',
141-
'sourceRoot',
142-
'mapRoot',
143-
'inlineSources',
144-
'emitBOM',
145-
'newLine',
146-
'stripInternal',
147-
'noEmitHelpers',
148-
'noEmitOnError',
149-
'preserveConstEnums',
150-
'declarationDir',
151-
'preserveValueImports',
152-
/* Interop Constraints */
153-
'isolatedModules',
154-
'verbatimModuleSyntax',
155-
'allowSyntheticDefaultImports',
156-
'esModuleInterop',
157-
'preserveSymlinks',
158-
'forceConsistentCasingInFileNames',
159-
/* Type Checking */
160-
'strict',
161-
'noImplicitAny',
162-
'strictNullChecks',
163-
'strictFunctionTypes',
164-
'strictBindCallApply',
165-
'strictPropertyInitialization',
166-
'noImplicitThis',
167-
'useUnknownInCatchVariables',
168-
'alwaysStrict',
169-
'noUnusedLocals',
170-
'noUnusedParameters',
171-
'exactOptionalPropertyTypes',
172-
'noImplicitReturns',
173-
'noFallthroughCasesInSwitch',
174-
'noUncheckedIndexedAccess',
175-
'noImplicitOverride',
176-
'noPropertyAccessFromIndexSignature',
177-
'allowUnusedLabels',
178-
'allowUnreachableCode',
179-
/* Completeness */
180-
'skipDefaultLibCheck',
181-
'skipLibCheck',
182-
],
183-
},
184-
],
185-
},
186-
}],
187-
),
190+
}]
191+
),
192+
],
188193
rules: {
189194
'import/named': 'off',
190195

0 commit comments

Comments
 (0)
Please sign in to comment.