Skip to content

Commit

Permalink
fix: tsconfig lint not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 19, 2023
1 parent 96e547a commit aca3051
Showing 1 changed file with 129 additions and 124 deletions.
253 changes: 129 additions & 124 deletions packages/eslint-config-ts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,132 @@ module.exports = {
node: { extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.d.ts'] },
},
},
overrides: basic.overrides.concat(
!fs.existsSync(join(process.cwd(), tsconfig))
overrides: [
...basic.overrides,
// TSConfig Sorting
{
files: ['**/tsconfig.json', '**/tsconfig.*.json'],
parser: 'jsonc-eslint-parser',
rules: {
'jsonc/sort-keys': [
'error',
{
pathPattern: '^$',
order: [
'extends',
'compilerOptions',
'references',
'files',
'include',
'exclude',
],
},
{
pathPattern: '^compilerOptions$',
order: [
/* Projects */
'incremental',
'composite',
'tsBuildInfoFile',
'disableSourceOfProjectReferenceRedirect',
'disableSolutionSearching',
'disableReferencedProjectLoad',
/* Language and Environment */
'target',
'lib',
'jsx',
'experimentalDecorators',
'emitDecoratorMetadata',
'jsxFactory',
'jsxFragmentFactory',
'jsxImportSource',
'reactNamespace',
'noLib',
'useDefineForClassFields',
'moduleDetection',
/* Modules */
'module',
'rootDir',
'moduleResolution',
'baseUrl',
'paths',
'rootDirs',
'typeRoots',
'types',
'allowUmdGlobalAccess',
'moduleSuffixes',
'allowImportingTsExtensions',
'resolvePackageJsonExports',
'resolvePackageJsonImports',
'customConditions',
'resolveJsonModule',
'allowArbitraryExtensions',
'noResolve',
/* JavaScript Support */
'allowJs',
'checkJs',
'maxNodeModuleJsDepth',
/* Emit */
'declaration',
'declarationMap',
'emitDeclarationOnly',
'sourceMap',
'inlineSourceMap',
'outFile',
'outDir',
'removeComments',
'noEmit',
'importHelpers',
'importsNotUsedAsValues',
'downlevelIteration',
'sourceRoot',
'mapRoot',
'inlineSources',
'emitBOM',
'newLine',
'stripInternal',
'noEmitHelpers',
'noEmitOnError',
'preserveConstEnums',
'declarationDir',
'preserveValueImports',
/* Interop Constraints */
'isolatedModules',
'verbatimModuleSyntax',
'allowSyntheticDefaultImports',
'esModuleInterop',
'preserveSymlinks',
'forceConsistentCasingInFileNames',
/* Type Checking */
'strict',
'strictBindCallApply',
'strictFunctionTypes',
'strictNullChecks',
'strictPropertyInitialization',
'allowUnreachableCode',
'allowUnusedLabels',
'alwaysStrict',
'exactOptionalPropertyTypes',
'noFallthroughCasesInSwitch',
'noImplicitAny',
'noImplicitOverride',
'noImplicitReturns',
'noImplicitThis',
'noPropertyAccessFromIndexSignature',
'noUncheckedIndexedAccess',
'noUnusedLocals',
'noUnusedParameters',
'useUnknownInCatchVariables',
/* Completeness */
'skipDefaultLibCheck',
'skipLibCheck',
],
},
],
},
},
// TS Aware Rules
...(!fs.existsSync(join(process.cwd(), tsconfig))
? []
: [{
parserOptions: {
Expand Down Expand Up @@ -63,128 +187,9 @@ module.exports = {
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
},
}, {
files: ['tsconfig.json', 'tsconfig.*.json'],
parser: 'jsonc-eslint-parser',
rules: {
'jsonc/sort-keys': [
'error',
{
pathPattern: '^$',
order: [
'extends',
'compilerOptions',
'references',
'files',
'include',
'exclude',
],
},
{
pathPattern: '^compilerOptions$',
order: [
/* Projects */
'incremental',
'composite',
'tsBuildInfoFile',
'disableSourceOfProjectReferenceRedirect',
'disableSolutionSearching',
'disableReferencedProjectLoad',
/* Language and Environment */
'target',
'lib',
'jsx',
'experimentalDecorators',
'emitDecoratorMetadata',
'jsxFactory',
'jsxFragmentFactory',
'jsxImportSource',
'reactNamespace',
'noLib',
'useDefineForClassFields',
'moduleDetection',
/* Modules */
'module',
'rootDir',
'moduleResolution',
'baseUrl',
'paths',
'rootDirs',
'typeRoots',
'types',
'allowUmdGlobalAccess',
'moduleSuffixes',
'allowImportingTsExtensions',
'resolvePackageJsonExports',
'resolvePackageJsonImports',
'customConditions',
'resolveJsonModule',
'allowArbitraryExtensions',
'noResolve',
/* JavaScript Support */
'allowJs',
'checkJs',
'maxNodeModuleJsDepth',
/* Emit */
'declaration',
'declarationMap',
'emitDeclarationOnly',
'sourceMap',
'inlineSourceMap',
'outFile',
'outDir',
'removeComments',
'noEmit',
'importHelpers',
'importsNotUsedAsValues',
'downlevelIteration',
'sourceRoot',
'mapRoot',
'inlineSources',
'emitBOM',
'newLine',
'stripInternal',
'noEmitHelpers',
'noEmitOnError',
'preserveConstEnums',
'declarationDir',
'preserveValueImports',
/* Interop Constraints */
'isolatedModules',
'verbatimModuleSyntax',
'allowSyntheticDefaultImports',
'esModuleInterop',
'preserveSymlinks',
'forceConsistentCasingInFileNames',
/* Type Checking */
'strict',
'noImplicitAny',
'strictNullChecks',
'strictFunctionTypes',
'strictBindCallApply',
'strictPropertyInitialization',
'noImplicitThis',
'useUnknownInCatchVariables',
'alwaysStrict',
'noUnusedLocals',
'noUnusedParameters',
'exactOptionalPropertyTypes',
'noImplicitReturns',
'noFallthroughCasesInSwitch',
'noUncheckedIndexedAccess',
'noImplicitOverride',
'noPropertyAccessFromIndexSignature',
'allowUnusedLabels',
'allowUnreachableCode',
/* Completeness */
'skipDefaultLibCheck',
'skipLibCheck',
],
},
],
},
}],
),
}]
),
],
rules: {
'import/named': 'off',

Expand Down

0 comments on commit aca3051

Please sign in to comment.