Skip to content

Commit

Permalink
refactor: split expected rules by plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyiam committed Sep 21, 2024
1 parent 8505ff8 commit cbd1797
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/test/_expected-exported-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as importPlugin from 'eslint-plugin-import'
import * as nPlugin from 'eslint-plugin-n'
import * as promisePlugin from 'eslint-plugin-promise'

const rules: Record<string, TSESLint.SharedConfig.RuleEntry> = {
const eslintRules: Record<string, TSESLint.SharedConfig.RuleEntry> = {
'no-magic-numbers': ['off'],
'no-var': ['error'],
'object-shorthand': ['warn', 'properties'],
Expand Down Expand Up @@ -133,7 +133,9 @@ const rules: Record<string, TSESLint.SharedConfig.RuleEntry> = {
],
'valid-typeof': ['error', { requireStringLiterals: true }],
yoda: ['error', 'never'],
}

const importRules: Record<string, TSESLint.SharedConfig.RuleEntry> = {
'import/export': ['error'],
'import/first': ['error'],
'import/no-absolute-path': [
Expand All @@ -143,16 +145,23 @@ const rules: Record<string, TSESLint.SharedConfig.RuleEntry> = {
'import/no-duplicates': ['error'],
'import/no-named-default': ['error'],
'import/no-webpack-loader-syntax': ['error'],
}

const nRules: Record<string, TSESLint.SharedConfig.RuleEntry> = {
'n/handle-callback-err': ['error', '^(err|error)$'],
'n/no-callback-literal': ['error'],
'n/no-deprecated-api': ['error'],
'n/no-exports-assign': ['error'],
'n/no-new-require': ['error'],
'n/no-path-concat': ['error'],
'n/process-exit-as-throw': ['error'],
}

const promiseRules: Record<string, TSESLint.SharedConfig.RuleEntry> = {
'promise/param-names': ['error'],
}

const tseslintRules: Record<string, TSESLint.SharedConfig.RuleEntry> = {
'@typescript-eslint/adjacent-overload-signatures': ['error'],
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/await-thenable': ['error'],
Expand Down Expand Up @@ -418,5 +427,11 @@ export const expectedExportedValue: TSESLint.FlatConfig.Config = {
n: nPlugin,
promise: promisePlugin,
},
rules,
rules: {
...eslintRules,
...importRules,
...nRules,
...promiseRules,
...tseslintRules,
},
}

0 comments on commit cbd1797

Please sign in to comment.