Skip to content

Commit fdb4a79

Browse files
authored
Feat/upgrade lint (#26)
* Upgrade lint deps * Run fix
1 parent fd756d5 commit fdb4a79

File tree

6 files changed

+737
-744
lines changed

6 files changed

+737
-744
lines changed

.eslintrc

Lines changed: 0 additions & 57 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ import useAnimationFrame from "@phntms/use-animation-frame";
4545

4646
useAnimationFrame((deltaTime: number) => {
4747
console.log(
48-
`I'm called approximately every ~16ms, but I was actually triggered after ${deltaTime}ms.`
48+
`I'm called approximately every ~16ms, but I was actually triggered after ${deltaTime}ms.`,
4949
);
5050
});
5151

5252
useAnimationFrame((deltaTime: number) => {
5353
console.log(
54-
`I'm called approximately 30 times per second, but I was actually trigger after ${deltaTime}ms.`
54+
`I'm called approximately 30 times per second, but I was actually trigger after ${deltaTime}ms.`,
5555
);
5656
}, 30);
5757
```

eslint.config.mjs

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { defineConfig } from "eslint/config";
2+
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
3+
import prettier from "eslint-plugin-prettier";
4+
import _import from "eslint-plugin-import";
5+
import globals from "globals";
6+
import tsParser from "@typescript-eslint/parser";
7+
import path from "node:path";
8+
import { fileURLToPath } from "node:url";
9+
import js from "@eslint/js";
10+
import { FlatCompat } from "@eslint/eslintrc";
11+
12+
const __filename = fileURLToPath(import.meta.url);
13+
const __dirname = path.dirname(__filename);
14+
const compat = new FlatCompat({
15+
baseDirectory: __dirname,
16+
recommendedConfig: js.configs.recommended,
17+
allConfig: js.configs.all
18+
});
19+
20+
export default defineConfig([{
21+
extends: fixupConfigRules(compat.extends(
22+
"plugin:react/recommended",
23+
"plugin:react-hooks/recommended",
24+
"plugin:@typescript-eslint/recommended",
25+
"plugin:prettier/recommended",
26+
)),
27+
28+
plugins: {
29+
prettier: fixupPluginRules(prettier),
30+
import: fixupPluginRules(_import),
31+
},
32+
33+
languageOptions: {
34+
globals: {
35+
...globals.browser,
36+
...globals.node,
37+
...globals.jest,
38+
React: "writable",
39+
},
40+
41+
parser: tsParser,
42+
ecmaVersion: 5,
43+
sourceType: "commonjs",
44+
45+
parserOptions: {
46+
jsx: true,
47+
useJSXTextNode: true,
48+
},
49+
},
50+
51+
settings: {
52+
react: {
53+
version: "detect",
54+
},
55+
},
56+
57+
rules: {
58+
"react-hooks/rules-of-hooks": "error",
59+
"react-hooks/exhaustive-deps": "error",
60+
"react/react-in-jsx-scope": "off",
61+
"@typescript-eslint/explicit-function-return-type": "off",
62+
"@typescript-eslint/explicit-module-boundary-types": "off",
63+
"@typescript-eslint/ban-ts-comment": "off",
64+
"react/prop-types": "off",
65+
66+
"import/order": ["error", {
67+
groups: ["builtin", "external", "internal"],
68+
69+
pathGroups: [{
70+
pattern: "react",
71+
group: "external",
72+
position: "before",
73+
}],
74+
75+
pathGroupsExcludedImportTypes: ["react"],
76+
"newlines-between": "always",
77+
78+
alphabetize: {
79+
order: "asc",
80+
caseInsensitive: true,
81+
},
82+
}],
83+
84+
"prettier/prettier": "error",
85+
},
86+
}]);

0 commit comments

Comments
 (0)