mirror of
https://github.com/theoludwig/eslint-config-conventions.git
synced 2025-05-18 12:02:33 +02:00
Compare commits
4 Commits
v15.0.0
...
14d3e0ba30
Author | SHA1 | Date | |
---|---|---|---|
14d3e0ba30
|
|||
921aacdc9b
|
|||
a03e2bd109
|
|||
2db017e805
|
@ -129,7 +129,6 @@
|
|||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
"no-void": ["error", { "allowAsStatement": true }],
|
"no-void": ["error", { "allowAsStatement": true }],
|
||||||
"no-with": "error",
|
"no-with": "error",
|
||||||
"no-return-await": "error",
|
|
||||||
"object-shorthand": ["error", "properties"],
|
"object-shorthand": ["error", "properties"],
|
||||||
"one-var": ["error", { "initialized": "never" }],
|
"one-var": ["error", { "initialized": "never" }],
|
||||||
"prefer-const": ["error", { "destructuring": "all" }],
|
"prefer-const": ["error", { "destructuring": "all" }],
|
||||||
@ -314,8 +313,6 @@
|
|||||||
"error",
|
"error",
|
||||||
{ "allowNumber": true }
|
{ "allowNumber": true }
|
||||||
],
|
],
|
||||||
"no-return-await": "off",
|
|
||||||
"@typescript-eslint/return-await": "error",
|
|
||||||
"@typescript-eslint/strict-boolean-expressions": [
|
"@typescript-eslint/strict-boolean-expressions": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": "./index.js",
|
"extends": "./index.js",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"project": "./tsconfig.json"
|
"projectService": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,31 @@ test("ensure we validate correctly JavaScript files", async () => {
|
|||||||
const [withErrors] = await eslint.lintFiles(
|
const [withErrors] = await eslint.lintFiles(
|
||||||
"test/fixtures/javascript-with-errors.js",
|
"test/fixtures/javascript-with-errors.js",
|
||||||
)
|
)
|
||||||
assert.strictEqual(noErrors?.errorCount, 0)
|
assert.strictEqual(noErrors?.errorCount, 0, JSON.stringify(noErrors, null, 2))
|
||||||
assert.strictEqual(withErrors?.errorCount, 3)
|
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 () => {
|
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(
|
const [withErrors] = await eslint.lintFiles(
|
||||||
"test/fixtures/javascript-with-errors.js",
|
"test/fixtures/javascript-with-errors.js",
|
||||||
)
|
)
|
||||||
assert.strictEqual(noErrors?.errorCount, 0)
|
assert.strictEqual(noErrors?.errorCount, 0, JSON.stringify(noErrors, null, 2))
|
||||||
assert.strictEqual(withErrors?.errorCount, 3)
|
assert.strictEqual(
|
||||||
|
withErrors?.errorCount,
|
||||||
|
3,
|
||||||
|
JSON.stringify(withErrors, null, 2),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("ensure we allow top-level await", async () => {
|
test("ensure we allow top-level await", async () => {
|
||||||
const [lintResult] = await eslint.lintFiles(
|
const [lintResult] = await eslint.lintFiles(
|
||||||
"test/fixtures/top-level-await.mjs",
|
"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 () => {
|
test("ensure we allow to ignore floating promise with void operator (@typescript-eslint/no-floating-promises)", async () => {
|
||||||
const [lintResult] = await eslint.lintFiles(
|
const [lintResult] = await eslint.lintFiles(
|
||||||
"test/fixtures/typescript-no-errors-ignore-promise.ts",
|
"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