xojs / eslint-config-xo-typescript

ESLint shareable config for TypeScript to be used with eslint-config-xo
MIT License
171 stars 25 forks source link

Invalid configuration for `@typescript-eslint/no-restricted-imports` #76

Closed jamesacarr closed 1 year ago

jamesacarr commented 1 year ago

Using the latest version of @typescript-eslint (6.0.0) and eslint (8.44.0), an error is being thrown due to an incorrect configuration for @typescript-eslint/no-restricted-imports.

Oops! Something went wrong! :(

ESLint: 8.44.0

Error: .eslintrc.cjs#overrides[1] » eslint-config-xo-typescript/space » /Users/jamescarr/Git/jamesacarr/home/node_modules/eslint-config-xo-typescript/index.js:
    Configuration for rule "@typescript-eslint/no-restricted-imports" is invalid:
    Value ["error","domain","freelist","smalloc","punycode","sys","querystring","colors"] should be string.
    Value ["error","domain","freelist","smalloc","punycode","sys","querystring","colors"] should be object.
    Value ["error","domain","freelist","smalloc","punycode","sys","querystring","colors"] should match some schema in anyOf.
    Value ["error","domain","freelist","smalloc","punycode","sys","querystring","colors"] should be object.
    Value [["error","domain","freelist","smalloc","punycode","sys","querystring","colors"]] should match some schema in anyOf.

    at ConfigValidator.validateRuleOptions (/Users/jamescarr/Git/jamesacarr/home/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2039:23)
    at /Users/jamescarr/Git/jamesacarr/home/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2094:18
    at Array.forEach (<anonymous>)
    at ConfigValidator.validateRules (/Users/jamescarr/Git/jamesacarr/home/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2091:34)
    at ConfigValidator.validateConfigArray (/Users/jamescarr/Git/jamesacarr/home/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2217:18)
    at CascadingConfigArrayFactory._finalizeConfigArray (/Users/jamescarr/Git/jamesacarr/home/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3974:23)
    at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/jamescarr/Git/jamesacarr/home/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3780:21)
    at FileEnumerator._iterateFilesRecursive (/Users/jamescarr/Git/jamesacarr/home/node_modules/eslint/lib/cli-engine/file-enumerator.js:450:49)
    at _iterateFilesRecursive.next (<anonymous>)
    at FileEnumerator.iterateFiles (/Users/jamescarr/Git/jamesacarr/home/node_modules/eslint/lib/cli-engine/file-enumerator.js:299:49)

From what I can tell, it looks like the format for the options have changed for this rule. It should be possible to change the rule to one of the following, to get it working again:

'@typescript-eslint/no-restricted-imports': [
    'error',
    'error',
    'domain',
    'freelist',
    'smalloc',
    'punycode',
    'sys',
    'querystring',
    'colors'
]

OR

'@typescript-eslint/no-restricted-imports': [
    'error',
    {
        paths: [
            'error',
            'domain',
            'freelist',
            'smalloc',
            'punycode',
            'sys',
            'querystring',
            'colors'
        ],
    },
],