Skip to content

Commit

Permalink
test: config type change
Browse files Browse the repository at this point in the history
Co-authored-by: Shahar "Dawn" Or <[email protected]>
  • Loading branch information
rostislav-simonik and mightyiam committed Mar 9, 2024
1 parent 5edae8c commit 3c0c24b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
29 changes: 14 additions & 15 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const extractVersionSpec = (range: string): string => range.split('@').slice(-1)
const equivalents = [...(new Linter()).getRules().keys()]
.filter(name => Object.prototype.hasOwnProperty.call(typescriptEslintRules, name))

const ourRules = exported.rules
const ourRules: Linter.Config['rules'] = exported.rules
if (ourRules === undefined) throw new Error('we seem to be exporting no rules')

const standardRules = configStandard.rules
Expand Down Expand Up @@ -528,20 +528,19 @@ test('our configuration is compatible with the plugin and parser at bottom of pe
t.deepEqual(bottomPluginVersion, minPeerDepVersion.version, 'bottom plugin version is bottom of peer dep')
t.deepEqual(bottomParserVersion, minPeerDepVersion.version, 'bottom parser version is bottom of peer dep')

const config = structuredClone(exported)

config.plugins = [typescriptEslintBottomPlugin]
config.parser = typescriptEslintBottomParser

config.rules = Object.fromEntries(
Object.entries(ourRules).map(([name, config]) => [
name.replace('@typescript-eslint/', `${typescriptEslintBottom}/`),
config
])
)

config.parserOptions = {
project: './tsconfig.json'
const config = {
...structuredClone(exported),
plugins: [typescriptEslintBottomPlugin],
parser: typescriptEslintBottomParser,
rules: Object.fromEntries(
Object.entries(ourRules).map(([name, config]) => [
name.replace('@typescript-eslint/', `${typescriptEslintBottom}/`),
config
])
),
parserOptions: {
project: './tsconfig.json'
}
}

const eslint = new ESLint({
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function fromEntries<T> (iterable: Array<[string, T]>): Record<string, T> {
}, {})
}

const config: Linter.Config = {
const config = {
extends: 'eslint-config-standard',
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
Expand Down Expand Up @@ -229,6 +229,6 @@ const config: Linter.Config = {
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: false }],
'no-void': ['error', { allowAsStatement: true }]
}
}
} satisfies Linter.Config

export = config

0 comments on commit 3c0c24b

Please sign in to comment.