diff options
author | 2024-07-10 00:16:04 +0100 | |
---|---|---|
committer | 2024-07-10 01:51:05 +0100 | |
commit | e22afcc2e4a91ed5948820b39996e7099bc30bde (patch) | |
tree | cac543ee9b0ef34738ffa447364b2e87fc8bf84e /eslint.config.mjs | |
parent | Update code component to use @uiw/react-codemirror (diff) |
Add new linting config
Diffstat (limited to 'eslint.config.mjs')
-rw-r--r-- | eslint.config.mjs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..24ee02b --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,71 @@ +import { fixupConfigRules, fixupPluginRules } from "@eslint/compat"; +import react from "eslint-plugin-react"; +import typescriptEslint from "@typescript-eslint/eslint-plugin"; +import globals from "globals"; +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [...fixupConfigRules(compat.extends( + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended", +)), { + plugins: { + react: fixupPluginRules(react), + "@typescript-eslint": fixupPluginRules(typescriptEslint), + }, + + languageOptions: { + globals: { + ...globals.browser, + }, + + parser: tsParser, + ecmaVersion: 12, + sourceType: "module", + + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + }, + + settings: { + react: { + pragma: "jsx", + version: "detect", + flowVersion: "0.53", + }, + }, + + rules: { + indent: ["error", 4, { + SwitchCase: 1, + }], + + quotes: ["error", "double"], + semi: ["error", "always"], + "no-trailing-spaces": "error", + "eol-last": "error", + "linebreak-style": "off", + "react/no-unknown-property": ["error", { "ignore": ["css"] }] + }, +}, { + files: ["**/*.test.ts*"], + + rules: { + "react/react-in-jsx-scope": "off" + }, +}]; |