mirror of
https://github.com/theoludwig/eslint-config-conventions.git
synced 2025-05-18 12:02:33 +02:00
Compare commits
9 Commits
v15.0.0
...
12f37d01b3
Author | SHA1 | Date | |
---|---|---|---|
12f37d01b3
|
|||
6af4b4f6ac
|
|||
b4f1c0b8dd
|
|||
116c3c600a
|
|||
4115843cc1
|
|||
14d3e0ba30
|
|||
921aacdc9b
|
|||
a03e2bd109
|
|||
2db017e805
|
@ -129,7 +129,6 @@
|
||||
"no-var": "error",
|
||||
"no-void": ["error", { "allowAsStatement": true }],
|
||||
"no-with": "error",
|
||||
"no-return-await": "error",
|
||||
"object-shorthand": ["error", "properties"],
|
||||
"one-var": ["error", { "initialized": "never" }],
|
||||
"prefer-const": ["error", { "destructuring": "all" }],
|
||||
@ -229,6 +228,12 @@
|
||||
"no-useless-constructor": "off",
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
||||
"@typescript-eslint/no-unnecessary-condition": [
|
||||
"error",
|
||||
{
|
||||
"allowConstantLoopConditions": true
|
||||
}
|
||||
],
|
||||
|
||||
"@typescript-eslint/adjacent-overload-signatures": "error",
|
||||
"@typescript-eslint/array-type": [
|
||||
@ -253,6 +258,7 @@
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/method-signature-style": "error",
|
||||
"@typescript-eslint/unbound-method": "error",
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"error",
|
||||
{
|
||||
@ -263,8 +269,10 @@
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-base-to-string": "error",
|
||||
"@typescript-eslint/no-deprecated": "error",
|
||||
"@typescript-eslint/no-dynamic-delete": "error",
|
||||
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||
"@typescript-eslint/no-redundant-type-constituents": "error",
|
||||
"@typescript-eslint/no-extraneous-class": [
|
||||
"error",
|
||||
{ "allowWithDecorator": true }
|
||||
@ -283,6 +291,7 @@
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
||||
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
||||
"@typescript-eslint/no-array-delete": "error",
|
||||
"@typescript-eslint/prefer-as-const": "error",
|
||||
"@typescript-eslint/prefer-function-type": "error",
|
||||
@ -314,8 +323,6 @@
|
||||
"error",
|
||||
{ "allowNumber": true }
|
||||
],
|
||||
"no-return-await": "off",
|
||||
"@typescript-eslint/return-await": "error",
|
||||
"@typescript-eslint/strict-boolean-expressions": [
|
||||
"error",
|
||||
{
|
||||
|
@ -56,8 +56,8 @@ If you want to use **TypeScript**, you also need to install:
|
||||
```sh
|
||||
npm install --save-dev \
|
||||
"typescript@^5.6.2" \
|
||||
"@typescript-eslint/eslint-plugin@^8.0.0" \
|
||||
"@typescript-eslint/parser@^8.0.0"
|
||||
"@typescript-eslint/eslint-plugin@^8.3.0" \
|
||||
"@typescript-eslint/parser@^8.3.0"
|
||||
```
|
||||
|
||||
Dependencies are:
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"extends": "./index.js",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
"projectService": true
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,31 @@ test("ensure we validate correctly JavaScript files", async () => {
|
||||
const [withErrors] = await eslint.lintFiles(
|
||||
"test/fixtures/javascript-with-errors.js",
|
||||
)
|
||||
assert.strictEqual(noErrors?.errorCount, 0)
|
||||
assert.strictEqual(withErrors?.errorCount, 3)
|
||||
assert.strictEqual(noErrors?.errorCount, 0, JSON.stringify(noErrors, null, 2))
|
||||
assert.strictEqual(
|
||||
withErrors?.errorCount,
|
||||
3,
|
||||
JSON.stringify(withErrors, null, 2),
|
||||
)
|
||||
})
|
||||
|
||||
test("ensure we do not use deprecated rules", async () => {
|
||||
const [javascriptLintResult] = await eslint.lintFiles(
|
||||
"test/fixtures/javascript-no-errors.js",
|
||||
)
|
||||
const [typescriptLintResult] = await eslint.lintFiles(
|
||||
"test/fixtures/typescript-no-errors.ts",
|
||||
)
|
||||
assert.strictEqual(
|
||||
javascriptLintResult.usedDeprecatedRules.length,
|
||||
0,
|
||||
JSON.stringify(javascriptLintResult, null, 2),
|
||||
)
|
||||
assert.strictEqual(
|
||||
typescriptLintResult.usedDeprecatedRules.length,
|
||||
0,
|
||||
JSON.stringify(typescriptLintResult, null, 2),
|
||||
)
|
||||
})
|
||||
|
||||
test("ensure we validate correctly TypeScript files", async () => {
|
||||
@ -27,20 +50,32 @@ test("ensure we validate correctly TypeScript files", async () => {
|
||||
const [withErrors] = await eslint.lintFiles(
|
||||
"test/fixtures/javascript-with-errors.js",
|
||||
)
|
||||
assert.strictEqual(noErrors?.errorCount, 0)
|
||||
assert.strictEqual(withErrors?.errorCount, 3)
|
||||
assert.strictEqual(noErrors?.errorCount, 0, JSON.stringify(noErrors, null, 2))
|
||||
assert.strictEqual(
|
||||
withErrors?.errorCount,
|
||||
3,
|
||||
JSON.stringify(withErrors, null, 2),
|
||||
)
|
||||
})
|
||||
|
||||
test("ensure we allow top-level await", async () => {
|
||||
const [lintResult] = await eslint.lintFiles(
|
||||
"test/fixtures/top-level-await.mjs",
|
||||
)
|
||||
assert.strictEqual(lintResult?.errorCount, 0)
|
||||
assert.strictEqual(
|
||||
lintResult?.errorCount,
|
||||
0,
|
||||
JSON.stringify(lintResult, null, 2),
|
||||
)
|
||||
})
|
||||
|
||||
test("ensure we allow to ignore floating promise with void operator (@typescript-eslint/no-floating-promises)", async () => {
|
||||
const [lintResult] = await eslint.lintFiles(
|
||||
"test/fixtures/typescript-no-errors-ignore-promise.ts",
|
||||
)
|
||||
assert.strictEqual(lintResult?.errorCount, 0)
|
||||
assert.strictEqual(
|
||||
lintResult?.errorCount,
|
||||
0,
|
||||
JSON.stringify(lintResult, null, 2),
|
||||
)
|
||||
})
|
||||
|
Reference in New Issue
Block a user