mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
ESLint: enforce prefer-const where possible
https://eslint.org/docs/latest/rules/prefer-const In our tests we use this pattern a lot: ``` let something; beforeEach(() => { something = ...; }); ``` This is not valid ~ prefer-const, but can be "let through" with some configuration. However, this would make the rule too loose for the non-test codebase. Therefore, we enable it overall but turn it off for tests only -- the `*.spec.ts` overrides apply to test files only and take precedence over `*.ts`
This commit is contained in:
@@ -104,7 +104,7 @@
|
|||||||
"allowTernary": true
|
"allowTernary": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prefer-const": "off", // todo: re-enable & fix errors (more strict than it used to be in TSLint)
|
"prefer-const": "error",
|
||||||
"prefer-spread": "off",
|
"prefer-spread": "off",
|
||||||
"no-underscore-dangle": "off",
|
"no-underscore-dangle": "off",
|
||||||
|
|
||||||
@@ -213,6 +213,21 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.spec.ts"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": [
|
||||||
|
"./tsconfig.json",
|
||||||
|
"./cypress/tsconfig.json"
|
||||||
|
],
|
||||||
|
"createDefaultProgram": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"prefer-const": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
"*.html"
|
"*.html"
|
||||||
|
Reference in New Issue
Block a user