Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jamesacarr opened this issue Jul 14, 2023 · 0 comments · Fixed by #77
Closed

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

jamesacarr opened this issue Jul 14, 2023 · 0 comments · Fixed by #77

Comments

@jamesacarr
Copy link
Contributor

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'
		],
	},
],
@jamesacarr jamesacarr changed the title Invalid configuration for Invalid configuration for @typescript-eslint/no-restricted-imports Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant