Skip to content

Commit 0527970

Browse files
authored
ESLint v9 (roblox-ts#2786)
1 parent 89afb27 commit 0527970

13 files changed

+453
-514
lines changed

.eslintignore

-2
This file was deleted.

.eslintrc

-56
This file was deleted.

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
*.yml
2+
/out
3+
/node_modules
4+
/tests
5+
/.devcontainer
6+
/CHANGELOG.md

.vscode/extensions.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
{
2-
"recommendations": [
3-
"dbaeumer.vscode-eslint",
4-
"editorconfig.editorconfig",
5-
]
2+
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "editorconfig.editorconfig"]
63
}

.vscode/settings.example.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"[typescript]": {
3-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
44
},
55
"editor.formatOnSave": true,
6-
"eslint.format.enable": true,
6+
"eslint.options": {
7+
"flags": ["unstable_ts_config"]
8+
},
79
"files.eol": "\n",
810
"typescript.tsdk": "node_modules/typescript/lib",
911
"typescript.preferences.importModuleSpecifier": "non-relative",

eslint.config.ts

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { FlatCompat } from "@eslint/eslintrc";
2+
import eslint from "@eslint/js";
3+
import comments from "@eslint-community/eslint-plugin-eslint-comments";
4+
import prettierConfig from "eslint-config-prettier";
5+
import prettierPlugin from "eslint-plugin-prettier";
6+
import simpleImportSort from "eslint-plugin-simple-import-sort";
7+
import tseslint from "typescript-eslint";
8+
9+
const compat = new FlatCompat({ baseDirectory: __dirname });
10+
11+
export default tseslint.config(
12+
eslint.configs.recommended,
13+
...tseslint.configs.recommended,
14+
...compat.extends("plugin:prettier/recommended"),
15+
prettierConfig,
16+
{
17+
languageOptions: {
18+
parser: tseslint.parser,
19+
parserOptions: {
20+
ecmaVersion: "latest",
21+
sourceType: "module",
22+
project: ["./tsconfig.json", "./tsconfig.eslint.json", "./src/*/tsconfig.json"],
23+
ecmaFeatures: { jsx: true },
24+
},
25+
},
26+
plugins: {
27+
"@typescript-eslint": tseslint.plugin,
28+
prettier: prettierPlugin,
29+
"simple-import-sort": simpleImportSort,
30+
"eslint-comments": comments,
31+
},
32+
rules: {
33+
// off
34+
"@typescript-eslint/explicit-function-return-type": "off",
35+
"@typescript-eslint/explicit-module-boundary-types": "off",
36+
"@typescript-eslint/no-empty-function": "off",
37+
"@typescript-eslint/no-empty-interface": "off",
38+
"@typescript-eslint/no-namespace": "off",
39+
"@typescript-eslint/no-non-null-assertion": "off",
40+
"@typescript-eslint/no-use-before-define": "off",
41+
"no-debugger": "off",
42+
"no-extra-boolean-cast": "off",
43+
44+
// warn
45+
"@typescript-eslint/no-unused-expressions": "warn",
46+
"@typescript-eslint/no-unused-vars": "warn",
47+
"eslint-comments/disable-enable-pair": ["warn", { allowWholeFile: true }],
48+
"eslint-comments/no-unused-disable": "warn",
49+
"eslint-comments/require-description": "warn",
50+
"no-console": "warn",
51+
"no-undef-init": "warn",
52+
"prefer-const": ["warn", { destructuring: "all" }],
53+
"prettier/prettier": "warn",
54+
"simple-import-sort/exports": "warn",
55+
"simple-import-sort/imports": "warn",
56+
curly: ["warn", "multi-line", "consistent"],
57+
58+
// error
59+
"@typescript-eslint/array-type": ["error", { default: "generic", readonly: "generic" }],
60+
"@typescript-eslint/no-deprecated": "error",
61+
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }],
62+
"@typescript-eslint/no-require-imports": "error",
63+
"no-constant-condition": ["error", { checkLoops: false }],
64+
"no-restricted-imports": ["error", { patterns: [".*"] }],
65+
},
66+
},
67+
{
68+
ignores: ["node_modules/", "tests/", "out/", "coverage/", "devlink/"],
69+
},
70+
);

0 commit comments

Comments
 (0)