From 85b2c1e233114d4f443ece52ad02c304f593c292 Mon Sep 17 00:00:00 2001 From: Bas Meeuwissen Date: Fri, 3 Jan 2025 16:36:15 +0100 Subject: [PATCH] #362: working with all rules --- eslint.config.js | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..5b5aacbe --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,61 @@ +import eslint from '@eslint/js'; +import * as tseslint from '@typescript-eslint/eslint-plugin'; +import tsparser from '@typescript-eslint/parser'; +import react from 'eslint-plugin-react'; +import reactHooks from 'eslint-plugin-react-hooks'; +import sonarjs from 'eslint-plugin-sonarjs'; + +export default [ + { + ignores: [ + "**/dist/**/*", + "**/node_modules/**/*", + "**/coverage/**/*", + "**/*config*" + ] + }, + { + files: ["**/*.{ts,tsx}"], + plugins: { + '@typescript-eslint': tseslint, + 'react': react, + 'react-hooks': reactHooks, + 'sonarjs': sonarjs + }, + languageOptions: { + parser: tsparser, + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + ecmaFeatures: { + jsx: true + } + } + }, + rules: { + ...eslint.configs.recommended.rules, + ...tseslint.configs.recommended.rules, + ...tseslint.configs.stylistic.rules, + ...sonarjs.configs.recommended.rules, + ...react.configs.recommended.rules, + ...reactHooks.configs.recommended.rules, + "@typescript-eslint/no-unsafe-function-type": "off", + "@typescript-eslint/consistent-type-definitions": "off", + "no-return-await": "error", + "semi": ["error", "always"], + "eol-last": ["error", "always"], + "brace-style": ["error", "allman", { "allowSingleLine": true }], + "react/jsx-uses-react": "off", + "react/react-in-jsx-scope": "off", + "sonarjs/assertions-in-tests": "off", + + // typescript handles this for us + "no-undef": "off", + }, + settings: { + react: { + version: 'detect' + } + } + } +]; \ No newline at end of file