Skip to content

Commit 0bd5d1c

Browse files
committed
feat: more work on the configs
Signed-off-by: prisis <[email protected]>
1 parent f96bae2 commit 0bd5d1c

File tree

9 files changed

+1562
-1504
lines changed

9 files changed

+1562
-1504
lines changed

Diff for: packages/eslint-config/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
"eslint-plugin-no-only-tests": "^3.3.0",
131131
"@jsenv/eslint-import-resolver": "^8.2.0",
132132
"@stylistic/eslint-plugin": "^2.12.1",
133+
"@stylistic/eslint-plugin-ts": "^2.12.1",
133134
"typescript-eslint": "^8.18.2",
134135
"@typescript-eslint/eslint-plugin": "^8.18.2",
135136
"@typescript-eslint/parser": "^8.18.2",

Diff for: packages/eslint-config/src/config/best-practices.ts

+44-41
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,48 @@
11
import { createConfig, getFilesGlobs } from "../utils/create-config";
22
import type { OptionsFiles } from "../types";
3+
import { Linter } from "eslint";
4+
5+
export const bestPracticesRules: Partial<Linter.RulesRecord> = {
6+
// Disallow non-null assertions using the ! postfix operator.
7+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
8+
"no-return-await": "off",
9+
10+
// Disallow calling a value with type any.
11+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
12+
"no-unused-expressions": "off",
13+
14+
// Disallow type assertions that do not change the type of expression.
15+
// Disable the "no-throw-literal" rule, as it can report incorrect errors on TypeScript code
16+
"no-throw-literal": "off",
17+
18+
// Disallow empty exports that don't change anything in a module file.
19+
// Breaks @typescript-eslint/parser
20+
strict: "off",
21+
22+
// Disable the "dot-notation" rule, as it can report incorrect errors on TypeScript code
23+
"dot-notation": "off",
24+
25+
// Require explicit return and argument types on exported functions' and classes' public class methods.
26+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
27+
"no-empty-function": "off",
28+
29+
// Disallow using to delete operator on computed key expressions.
30+
// Disable the "no-implied-eval" and "no-new-func" rule, as it can report incorrect errors on TypeScript code
31+
"no-implied-eval": "off",
32+
"no-new-func": "off",
33+
34+
// Disallow extra non-null assertions.
35+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
36+
"no-loop-func": "off",
37+
38+
// Disallow void type outside of generic or return types.
39+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
40+
"no-magic-numbers": "off",
41+
42+
// Disallow non-null assertions after an optional chain expression.
43+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
44+
"no-redeclare": "off",
45+
};
346

447
export default createConfig<OptionsFiles>("all", async (config, oFiles) => {
548
const { files = oFiles } = config;
@@ -456,47 +499,7 @@ export default createConfig<OptionsFiles>("all", async (config, oFiles) => {
456499
{
457500
name: "anolilab/best-practices/ts-rules",
458501
files: getFilesGlobs("ts"),
459-
rules: {
460-
// Disallow non-null assertions using the ! postfix operator.
461-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
462-
"no-return-await": "off",
463-
464-
// Disallow calling a value with type any.
465-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
466-
"no-unused-expressions": "off",
467-
468-
// Disallow type assertions that do not change the type of expression.
469-
// Disable the "no-throw-literal" rule, as it can report incorrect errors on TypeScript code
470-
"no-throw-literal": "off",
471-
472-
// Disallow empty exports that don't change anything in a module file.
473-
// Breaks @typescript-eslint/parser
474-
strict: "off",
475-
476-
// Disable the "dot-notation" rule, as it can report incorrect errors on TypeScript code
477-
"dot-notation": "off",
478-
479-
// Require explicit return and argument types on exported functions' and classes' public class methods.
480-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
481-
"no-empty-function": "off",
482-
483-
// Disallow using to delete operator on computed key expressions.
484-
// Disable the "no-implied-eval" and "no-new-func" rule, as it can report incorrect errors on TypeScript code
485-
"no-implied-eval": "off",
486-
"no-new-func": "off",
487-
488-
// Disallow extra non-null assertions.
489-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
490-
"no-loop-func": "off",
491-
492-
// Disallow void type outside of generic or return types.
493-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
494-
"no-magic-numbers": "off",
495-
496-
// Disallow non-null assertions after an optional chain expression.
497-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
498-
"no-redeclare": "off",
499-
},
502+
rules: bestPracticesRules,
500503
},
501504
];
502505
});

0 commit comments

Comments
 (0)