I configured ecmaVersion 6 for my test files but it does not lint features that are not available in ecma6. Rules are working fine.
.eslintrc.js
module.exports = {
root: true,
extends: ['airbnb-base', '.eslintrc.airbnbonlywarnings.js'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
ecmaFeatures: {
blockBindings: false,
forOf: false
},
project: 'tsconfig.json',
tsconfigRootDir: __dirname
},
plugins: ['@typescript-eslint'],
env: {
browser: true,
jasmine: true,
node: true,
mocha: false,
amd: true
},
overrides: [{
files: ['**/e2e/**/*.ts', '**/e2e/**/*.js'],
parserOptions: {
ecmaVersion: 6,
project: 'tsconfig.e2e.json'
}
}]
}
tsconfig.e2e.json
{
"compilerOptions": {
"rootDir": ".",
"outDir": "build-e2e",
"allowJs": true,
"incremental": true,
"moduleResolution": "node",
"module": "commonjs",
"target": "es6",
"noEmitOnError": true,
"strict": false,
"typeRoots" :[
"./@types",
"./node_modules/@types"
],
"removeComments": false,
"sourceMap": false
},
"include": [
"@types/**/*.d.ts",
"test/protractor/**/*.ts",
"test/protractor/**/*.js",
"src/**/test/e2e/**/*.ts",
"src/**/test/e2e/**/*.js",
"grunt/users/**/fake.config.ts"
],
"exclude":[
"./node_modules",
"./customer_bundles"
]
}
Example code:
const myObj = { a: 'somestring', b: 42, c: false };
const tmp = Object.values(object1);
Expected Result Because Object.values() is a feature introduced in ecma 2017 it should lint that line because I specified ecmaVersion 6 aka 2015
Actual Result It's not linting
Additional Info It's not linting in IntelliJ and also not via console. No errors in console. Upgraded @typescript-eslint/parser 2.25.0 to 4.1 but that didn't help.
Versions
- @typescript-eslint/parser 2.25.0
- TypeScript 3.9.2
- ESLint 6.3.0
- node 14.4.0
So what I'm doing wrong?
Ok, the ecmaVersion doesn't do much in combination with @typescript-eslint/parser according to the developer. I'm now using eslint-plugin-es to lint ecma features. That works as intended.