ESLint ignores uninitialized vars when using @scriptable-ios/eslint-config
Closed this issue · 3 comments
demenik commented
When I added the ESLint config to my project, ESLint stopped detecting uninitialized variables.
My Scriptable folder looks like this:
Scriptable Folder
├──jsconfig.json
├──package.json
├──Script.js
└──...
jsconfig.json
{
"compilerOptions": {
"lib": ["ES2021"],
"moduleDetection": "force"
}
}
package.json
{
"name": "scriptable",
"version": "1.0.0",
"eslintConfig": {
"extends": "@scriptable-ios",
"rules": {
"no-unused-vars": "warn"
},
"parserOptions": { // workaround for top level await
"ecmaVersion": "latest",
"sourceType": "module"
}
},
"devDependencies": {
"@scriptable-ios/eslint-config": "latest",
"@types/scriptable-ios": "latest",
"eslint": "latest"
}
}
There still is IntelliSense for Scriptable API, unused-vars, ... but missing errors for uninitialized vars.
schl3ck commented
Thank you for including all configuration files!
I think the issue is the comment in your package.json
because there are no comments allowed in JSON.
demenik commented
The comment is not actually there. I just added it for clarification
demenik commented
I fixed the issue by changing the eslintConfig:
{
"name": "scriptable",
"version": "1.0.0",
"eslintConfig": {
"extends": [
"eslint:recommended", // Added the default eslint back
"@scriptable-ios"
],
"rules": {
"no-unused-vars": "warn"
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
}
},
"devDependencies": {
"@scriptable-ios/eslint-config": "latest",
"@types/scriptable-ios": "latest",
"eslint": "latest"
}
}