I am sure that this is something that was already asked multiple times, but I simply cannot get the error related to type "any" with typescript-eslint I have some sample code in src\index.ts
const testArray = [1, 2, 3];
const testString = JSON.stringify(testArray);
const test_Array2 = JSON.parse(testString);
console.log(test_Array2.length);
I have configured the .eslintrc according to my best knowledge
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"tsconfigRootDir": "./",
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {},
"env": {
"browser": true,
"node": true
}
}
I have a very minimalistic package.json
{
"name": "typescript-starter",
"version": "1.0.0",
"description": "test.",
"main": "index.js",
"scripts": {
"lint": "eslint . --ext .ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^12.7.2",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"eslint": "^6.8.0",
"rimraf": "^3.0.0",
"typescript": "^4.3.5"
},
"dependencies": {}
}
and very simple tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"lib": ["es6"],
"allowJs": true,
"outDir": "build",
"rootDir": "src",
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"types": ["node"],
"typeRoots": ["./node_modules/@types"]
},
"include": ["src/**/*"]
}
My expectation is that the linter should complain about me using test_Array2.length since test_Array2 has type any (and implicit usage of type any is prohibited in the @typescript-eslint/recommended). Instead the only errors I get are related to camelcase (which proves that my config is actually checking SOMETHING)
3:7 error Identifier 'test_Array2' is not in camel case @typescript-eslint/camelcase
5:13 error Identifier 'test_Array2' is not in camel case @typescript-eslint/camelcase
I am using @typescript-eslint/eslint-plugin@2.34.0 and @typescript-eslint/parser@2.34.0 (basically the most recent version)
Can somebody bring some light onto what I should change to actually get the error from linter?