-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed as not planned
Closed as not planned
Copy link
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Relevant Package
eslint-plugin-tslint
Playground Link
No response
Repro Code
The easiest way is to clone the CKEditor 5 repository – https://github.com/ckeditor/ckeditor5 – then install dependencies (yarn/npm install) and execute the lint task (yarn/npm lint).
I can reproduce an error by executing the linter on a single file: yarn eslint packages/ckeditor5-clipboard/src/clipboardpipeline.ts
ESLint Config
module.exports = {
extends: 'ckeditor5',
ignorePatterns: [
// The CKEditor 5 core DLL build is created from JavaScript files.
// ESLint should not process a compiled TypeScript.
'src/*.js'
],
rules: {
'ckeditor5-rules/ckeditor-imports': 'error',
'ckeditor5-rules/license-header': [ 'error', {
headerLines: [
'/**',
' * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.',
' * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license',
' */'
]
} ]
},
overrides: [
{
files: [ '**/tests/**/*.js' ],
rules: {
'no-unused-expressions': 'off',
'ckeditor5-rules/ckeditor-imports': 'off',
'ckeditor5-rules/no-cross-package-imports': 'off'
}
},
{
files: [ '**/docs/**/*.js' ],
rules: {
'ckeditor5-rules/ckeditor-imports': 'off'
}
}
]
};tsconfig
Expected Result
No syntax error.
Actual Result
Oops! Something went wrong! :(
ESLint: 7.32.0
TypeError: Cannot read properties of undefined (reading 'after')
Occurred while linting /Users/pomek/Projects/ckeditor/ckeditor5/packages/ckeditor5-clipboard/src/clipboardpipeline.ts:14
at ImportDeclaration[importKind=type] (/Users/pomek/Projects/ckeditor/ckeditor5/node_modules/@typescript-eslint/eslint-plugin/dist/rules/keyword-spacing.js:65:40)
at /Users/pomek/Projects/ckeditor/ckeditor5/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/Users/pomek/Projects/ckeditor/ckeditor5/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/Users/pomek/Projects/ckeditor/ckeditor5/node_modules/eslint/lib/linter/node-event-generator.js:293:26)
at NodeEventGenerator.applySelectors (/Users/pomek/Projects/ckeditor/ckeditor5/node_modules/eslint/lib/linter/node-event-generator.js:322:22)
at NodeEventGenerator.enterNode (/Users/pomek/Projects/ckeditor/ckeditor5/node_modules/eslint/lib/linter/node-event-generator.js:336:14)
at CodePathAnalyzer.enterNode (/Users/pomek/Projects/ckeditor/ckeditor5/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
at /Users/pomek/Projects/ckeditor/ckeditor5/node_modules/eslint/lib/linter/linter.js:960:32
at Array.forEach (<anonymous>)
error Command failed with exit code 2.
Additional Info
The stack trace leads to
typescript-eslint/packages/eslint-plugin/src/rules/keyword-spacing.ts
Lines 61 to 70 in b1f4dad
| if (context.options[0].after && spacesBetweenTypeAndPunctuator === 0) { | |
| context.report({ | |
| loc: punctuatorToken.loc, | |
| messageId: 'expectedBefore', | |
| data: { value: punctuatorToken.value }, | |
| fix(fixer) { | |
| return fixer.insertTextBefore(punctuatorToken, ' '); | |
| }, | |
| }); | |
| } |
Versions
| package | version |
|---|---|
@typescript-eslint/eslint-plugin |
5.44.0 |
@typescript-eslint/parser |
5.44.0 |
@typescript-eslint/scope-manager |
5.44.0 |
@typescript-eslint/typescript-estree |
5.44.0 |
@typescript-eslint/type-utils |
5.44.0 |
@typescript-eslint/utils |
5.44.0 |
typescript |
4.9.3 |
eslint |
7.32.0 |
node |
18.11.0 |
Note: When installing "@typescript-eslint/eslint-plugin": "~5.43.0", the executed command does not throw the error. So, it seems to be a regression.
Metadata
Metadata
Assignees
Labels
duplicateThis issue or pull request already existsThis issue or pull request already exists
{ "compilerOptions": { "lib": [ "DOM" ], "noImplicitAny": true, "noImplicitOverride": true, "strict": true, "module": "es6", "target": "es2020", "sourceMap": true, "allowJs": true, "moduleResolution": "node" }, "include": [ "./typings/" ] }