Skip to content

Commit

Permalink
chore: split up some test data
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyiam committed Dec 21, 2024
1 parent de0c1e5 commit a891baf
Show file tree
Hide file tree
Showing 10 changed files with 247 additions and 237 deletions.
18 changes: 18 additions & 0 deletions src/test/expected-exported-value/_eslint-comments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { TSESLint } from '@typescript-eslint/utils'

export const expectedEslintCommentsRules: Record<
string,
TSESLint.SharedConfig.RuleEntry
> = {
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
'eslint-comments/no-aggregating-enable': ['error'],
'eslint-comments/no-duplicate-disable': ['error'],
'eslint-comments/no-unlimited-disable': ['error'],
'eslint-comments/no-unused-enable': ['error'],
'eslint-comments/require-description': [
'error',
{
ignore: ['eslint-enable', 'eslint-env'],
},
],
}
142 changes: 142 additions & 0 deletions src/test/expected-exported-value/_eslint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import type { TSESLint } from '@typescript-eslint/utils'

export const expectedEslintRules: Record<
string,
TSESLint.SharedConfig.RuleEntry
> = {
'accessor-pairs': [
'error',
{
setWithoutGet: true,
getWithoutSet: false,
enforceForClassMembers: true,
},
],
'array-callback-return': [
'error',
{
allowImplicit: false,
allowVoid: false,
checkForEach: false,
},
],
'arrow-body-style': [
'error',
'as-needed',
{ requireReturnForObjectLiteral: false },
],
complexity: [
'error',
{
variant: 'modified',
// eslint-disable-next-line @typescript-eslint/no-magic-numbers -- arbitrary choice
max: 5,
},
],
'consistent-this': ['error', 'that'],
'constructor-super': ['error'],
curly: ['error', 'multi-line'],
'default-case-last': ['error'],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'for-direction': ['error'],
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
'guard-for-in': ['error'],
'logical-assignment-operators': [
'error',
'always',
{ enforceForIfStatements: true },
],
// eslint-disable-next-line @typescript-eslint/no-magic-numbers -- default plus one
'max-depth': ['error', { max: 5 }],
'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
'no-async-promise-executor': ['error'],
'no-caller': ['error'],
'no-case-declarations': ['error'],
'no-class-assign': ['error'],
'no-compare-neg-zero': ['error'],
'no-cond-assign': ['error'],
'no-const-assign': ['error'],
'no-constant-binary-expression': ['error'],
'no-constant-condition': ['error', { checkLoops: false }],
'no-constructor-return': ['error'],
'no-control-regex': ['error'],
'no-debugger': ['error'],
'no-delete-var': ['error'],
'no-dupe-args': ['error'],
'no-dupe-keys': ['error'],
'no-duplicate-case': ['error'],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-empty-character-class': ['error'],
'no-empty-pattern': ['error'],
'no-eval': ['error'],
'no-ex-assign': ['error'],
'no-extend-native': ['error'],
'no-extra-bind': ['error'],
'no-extra-boolean-cast': ['error'],
'no-fallthrough': ['error'],
'no-func-assign': ['error'],
'no-global-assign': ['error'],
'no-import-assign': ['error'],
'no-invalid-regexp': ['error'],
'no-irregular-whitespace': ['error'],
'no-iterator': ['error'],
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
'no-lone-blocks': ['error'],
'no-loss-of-precision': ['error'],
'no-misleading-character-class': ['error'],
'no-multi-str': ['error'],
'no-new': ['error'],
'no-new-func': ['error'],
'no-new-native-nonconstructor': ['error'],
'no-new-wrappers': ['error'],
'no-obj-calls': ['error'],
'no-object-constructor': ['error'],
'no-octal': ['error'],
'no-octal-escape': ['error'],
'no-proto': ['error'],
'no-prototype-builtins': ['error'],
'no-regex-spaces': ['error'],
'no-return-assign': ['error', 'except-parens'],
'no-self-assign': ['error', { props: true }],
'no-self-compare': ['error'],
'no-sequences': ['error'],
'no-shadow-restricted-names': ['error'],
'no-sparse-arrays': ['error'],
'no-template-curly-in-string': ['error'],
'no-this-before-super': ['error'],
'no-unexpected-multiline': ['error'],
'no-unmodified-loop-condition': ['error'],
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
'no-unreachable': ['error'],
'no-unreachable-loop': ['error'],
'no-unsafe-finally': ['error'],
'no-unsafe-negation': ['error'],
'no-useless-backreference': ['error'],
'no-useless-call': ['error'],
'no-useless-catch': ['error'],
'no-useless-computed-key': ['error'],
'no-useless-escape': ['error'],
'no-useless-rename': ['error'],
'no-useless-return': ['error'],
'no-var': ['error'],
'no-void': ['error', { allowAsStatement: true }],
'no-with': ['error'],
'object-shorthand': ['warn', 'properties'],
'one-var': ['error', { initialized: 'never' }],
'prefer-const': [
'error',
{ destructuring: 'all', ignoreReadBeforeAssign: false },
],
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
'symbol-description': ['error'],
'unicode-bom': ['error', 'never'],
'use-isnan': [
'error',
{
enforceForSwitchCase: true,
enforceForIndexOf: true,
},
],
'valid-typeof': ['error', { requireStringLiterals: true }],
yoda: ['error', 'never'],
}
16 changes: 16 additions & 0 deletions src/test/expected-exported-value/_import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { TSESLint } from '@typescript-eslint/utils'

export const expectedImportRules: Record<
string,
TSESLint.SharedConfig.RuleEntry
> = {
'import/export': ['error'],
'import/first': ['error'],
'import/no-absolute-path': [
'error',
{ esmodule: true, commonjs: true, amd: false },
],
'import/no-duplicates': ['error'],
'import/no-named-default': ['error'],
'import/no-webpack-loader-syntax': ['error'],
}
43 changes: 43 additions & 0 deletions src/test/expected-exported-value/_index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import type { TSESLint } from '@typescript-eslint/utils'
import { parser, plugin as tseslintPlugin } from 'typescript-eslint'
import eslintCommentsPlugin from 'eslint-plugin-eslint-comments'
import importPlugin from 'eslint-plugin-import'
import nPlugin from 'eslint-plugin-n'
import promisePlugin from 'eslint-plugin-promise'
import { expectedEslintCommentsRules } from './_eslint-comments.js'
import { expectedEslintRules } from './_eslint.js'
import { expectedImportRules } from './_import.js'
import { expectedNRules } from './_n.js'
import { expectedPromiseRules } from './_promise.js'
import { expectedTseslintRules } from './_typescript-eslint.js'

export const expectedExportedRules = {
...expectedEslintCommentsRules,
...expectedEslintRules,
...expectedImportRules,
...expectedNRules,
...expectedPromiseRules,
...expectedTseslintRules,
}

export const expectedExportedValue: TSESLint.FlatConfig.Config = {
linterOptions: {
reportUnusedDisableDirectives: 'error',
},

languageOptions: {
parser,
parserOptions: {
projectService: true,
},
},

plugins: {
'@typescript-eslint': tseslintPlugin,
'eslint-comments': eslintCommentsPlugin,
import: importPlugin,
n: nPlugin,
promise: promisePlugin,
},
rules: expectedExportedRules,
}
11 changes: 11 additions & 0 deletions src/test/expected-exported-value/_n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { TSESLint } from '@typescript-eslint/utils'

export const expectedNRules: 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'],
}
9 changes: 9 additions & 0 deletions src/test/expected-exported-value/_promise.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { TSESLint } from '@typescript-eslint/utils'

export const expectedPromiseRules: Record<
string,
TSESLint.SharedConfig.RuleEntry
> = {
'promise/avoid-new': ['error'],
'promise/param-names': ['error'],
}
Loading

0 comments on commit a891baf

Please sign in to comment.