Answer the question
In order to leave comments, you need to log in
ESLint constantly throws errors for valid code, how to fix it?
Periodically, the Typescript parser for ESLint generates type errors. Parsing error: ',' expected.
After closing the file, the error disappears for a while, while the code, of course, works and compiles. Here is an example where the linter throws an error (this code is in the class):
set values(newValues: Values) {
if (Array.isArray(newValues)) {
if (this.checkValue(newValues)) {
this._values = newValues;
this.trigger('valueUpdated');
this.trigger('valueEnd');
} else throw new RangeError('Value is out of range!');
} else throw new TypeError('New value must be an Array!');
} //вот на этой скобке ошибка
module.exports = {
env: {
browser: true,
es6: true,
},
extends: ['airbnb-base', 'prettier', 'plugin:fsd/all'],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
projects: './tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'fsd'],
rules: {
indent: ['error', 2],
'no-underscore-dangle': ['error', { allowAfterThis: true }],
'no-tabs': ['error', { allowIndentationTabs: true }],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-console': 'off',
'no-undef': 'off',
'no-unused-vars': 'off',
'import/no-extraneous-dependencies': 'off',
'func-names': ['error', 'never'],
},
settings: {
'import/extensions': {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
};
{
"compilerOptions": {
"noImplicitAny": true,
"removeComments": true,
"target": "es5",
"noEmit": true,
"esModuleInterop": true
},
"include": [
"src/plugin/types/slider.d.ts",
"src/plugin/types/jquery.d.ts",
"src/plugin/slider/slider.ts"
],
"exclude": ["build/*", "dist/*", "node_modules/*", "src/plugin/tests/*"],
"awesomeTypescriptLoaderOptions": {
"useBabel": true,
"babelOptions": {
"babelrc": true
},
"babelCore": "@babel/core"
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question