Skip to content

Commit b9df547

Browse files
committed
Reconfigure for latest ESLint
1 parent c97a94e commit b9df547

File tree

3 files changed

+84
-55
lines changed

3 files changed

+84
-55
lines changed

.eslintrc.js

Lines changed: 0 additions & 55 deletions
This file was deleted.
File renamed without changes.

eslint.config.mjs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// @ts-check
2+
import babelParser from "@babel/eslint-parser";
3+
import js from "@eslint/js";
4+
import tsParser from "@typescript-eslint/parser";
5+
import { defineConfig, globalIgnores } from "eslint/config";
6+
import prettier from "eslint-config-prettier";
7+
import graphileExport from "eslint-plugin-graphile-export";
8+
import jest from "eslint-plugin-jest";
9+
import fs from "fs";
10+
import globals from "globals";
11+
import path from "path";
12+
import tseslint from "typescript-eslint";
13+
14+
const __dirname = import.meta.dirname;
15+
16+
const globalIgnoresFromFile = fs
17+
.readFileSync(path.resolve(__dirname, ".lintignore"), "utf8")
18+
.split("\n")
19+
.map((line) => line.trim())
20+
.filter((line) => line && !line.startsWith("#"))
21+
.map((line) => {
22+
let text = line;
23+
text = text.startsWith("/") ? text.substring(1) : `**/${text}`;
24+
text = text.endsWith("/") ? text + "**" : text;
25+
return text;
26+
});
27+
28+
/** @type {import('@eslint/config-helpers').ConfigWithExtends} */
29+
const config = {
30+
languageOptions: {
31+
parser: babelParser,
32+
sourceType: "module",
33+
globals: {
34+
jasmine: false,
35+
...globals.jest,
36+
...globals.node,
37+
},
38+
},
39+
40+
plugins: {
41+
jest,
42+
},
43+
44+
rules: {
45+
"jest/expect-expect": ["off"],
46+
"no-fallthrough": ["error", { allowEmptyCase: true }],
47+
"@typescript-eslint/no-var-requires": ["off"],
48+
"@typescript-eslint/no-explicit-any": ["off"],
49+
// We need this for our `GraphileBuild`/`GraphileConfig`/etc namespaces
50+
"@typescript-eslint/no-namespace": "off",
51+
"@typescript-eslint/no-unused-vars": [
52+
"warn",
53+
{
54+
argsIgnorePattern: "^_",
55+
varsIgnorePattern: "^_",
56+
args: "after-used",
57+
ignoreRestSiblings: true,
58+
},
59+
],
60+
},
61+
};
62+
63+
export default defineConfig([
64+
js.configs.recommended,
65+
tseslint.configs.recommended,
66+
// ...tseslint.configs.recommendedTypeChecked, // requires parserOptions.project
67+
graphileExport.configs.recommended,
68+
// TODO: plugin:jest/recommended
69+
prettier, // not a plugin, just a config object
70+
config,
71+
72+
//overrides:
73+
[
74+
// Rules for TypeScript only
75+
{
76+
files: ["*.ts", "*.tsx"],
77+
languageOptions: {
78+
parser: tsParser,
79+
},
80+
},
81+
],
82+
83+
globalIgnores(globalIgnoresFromFile),
84+
]);

0 commit comments

Comments
 (0)