mirror of
https://github.com/zen-browser/www.git
synced 2025-07-08 01:10:02 +02:00
feat(eslint): add eslint flat config
This commit is contained in:
parent
1937be58a6
commit
01f4dac75d
16 changed files with 4607 additions and 2125 deletions
59
.eslint/react.ts
Normal file
59
.eslint/react.ts
Normal file
|
@ -0,0 +1,59 @@
|
|||
import type { Linter } from "eslint";
|
||||
import react from "eslint-plugin-react";
|
||||
import { javascriptFiles, typescriptFiles } from "./shared";
|
||||
|
||||
export const reactConfig: Linter.Config = {
|
||||
name: "eslint/react",
|
||||
files: [
|
||||
...typescriptFiles.filter((f) => f.includes("tsx")),
|
||||
...javascriptFiles.filter((f) => f.includes("jsx")),
|
||||
],
|
||||
plugins: {
|
||||
react,
|
||||
},
|
||||
rules: {
|
||||
...react.configs.recommended.rules,
|
||||
|
||||
"react/react-in-jsx-scope": "off", // Not needed in modern React/Preact
|
||||
"react/prop-types": "off", // Using TypeScript
|
||||
"react/jsx-uses-react": "off",
|
||||
"react/jsx-uses-vars": "error",
|
||||
"react/no-unescaped-entities": "off",
|
||||
"react/jsx-key": "error",
|
||||
"react/jsx-no-useless-fragment": "error",
|
||||
"react/self-closing-comp": "error",
|
||||
"react/jsx-boolean-value": ["error", "never"],
|
||||
"react/jsx-curly-brace-presence": [
|
||||
"error",
|
||||
{ props: "never", children: "never" },
|
||||
],
|
||||
"react/function-component-definition": [
|
||||
"error",
|
||||
{
|
||||
namedComponents: "arrow-function",
|
||||
unnamedComponents: "arrow-function",
|
||||
},
|
||||
],
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: "detect",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
import reactHooks from "eslint-plugin-react-hooks";
|
||||
|
||||
export const reactHooksConfig: Linter.Config = {
|
||||
name: "eslint/react-hooks",
|
||||
files: [
|
||||
...typescriptFiles.filter((f) => f.includes("tsx")),
|
||||
...javascriptFiles.filter((f) => f.includes("jsx")),
|
||||
],
|
||||
plugins: {
|
||||
"react-hooks": reactHooks,
|
||||
},
|
||||
rules: {
|
||||
...reactHooks.configs.recommended.rules,
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue