-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-test-ts
- Loading branch information
Showing
129 changed files
with
2,638 additions
and
3,959 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat"; | ||
import prettier from "eslint-plugin-prettier"; | ||
import cypress from "eslint-plugin-cypress"; | ||
import testingLibrary from "eslint-plugin-testing-library"; | ||
import babelParser from "@babel/eslint-parser"; | ||
import path from "node:path"; | ||
import tseslint from "typescript-eslint"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
import react from "eslint-plugin-react"; | ||
import hooksPlugin from "eslint-plugin-react-hooks"; | ||
|
||
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("plugin:cypress/recommended", "plugin:prettier/recommended"), | ||
), | ||
...tseslint.configs.recommended, | ||
react.configs.flat.recommended, | ||
{ | ||
plugins: { | ||
"react-hooks": fixupPluginRules(hooksPlugin), | ||
}, | ||
rules: hooksPlugin.configs.recommended.rules, | ||
}, | ||
{ | ||
plugins: { | ||
prettier: fixupPluginRules(prettier), | ||
cypress: fixupPluginRules(cypress), | ||
"@typescript-eslint": tseslint.plugin, | ||
}, | ||
languageOptions: { | ||
parser: babelParser, | ||
ecmaVersion: 2018, | ||
sourceType: "module", | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
}, | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
rules: { | ||
"react/forbid-component-props": [ | ||
"error", | ||
{ | ||
forbid: [ | ||
{ | ||
propName: "data-test", | ||
message: "Use `data-testid` instead of `data-test` attribute", | ||
}, | ||
], | ||
}, | ||
], | ||
"react/forbid-dom-props": [ | ||
"error", | ||
{ | ||
forbid: [ | ||
{ | ||
propName: "data-test", | ||
message: "Use `data-testid` instead of `data-test` attribute", | ||
}, | ||
], | ||
}, | ||
], | ||
"react/display-name": "off", | ||
"react/prop-types": "off", | ||
"react/no-unescaped-entities": "off", | ||
"@typescript-eslint/no-empty-object-type": "off", | ||
"@typescript-eslint/no-unused-expressions": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
argsIgnorePattern: "^_", | ||
destructuredArrayIgnorePattern: "^_", | ||
varsIgnorePattern: "^_", | ||
}, | ||
], | ||
}, | ||
}, | ||
...fixupConfigRules(compat.extends("plugin:prettier/recommended")).map( | ||
(config) => ({ | ||
...config, | ||
files: ["**/*.ts?(x)"], | ||
}), | ||
), | ||
{ | ||
files: ["**/*.ts?(x)"], | ||
languageOptions: { | ||
parser: tseslint.parser, | ||
ecmaVersion: 2018, | ||
sourceType: "module", | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
}, | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
rules: { | ||
"prettier/prettier": "error", | ||
}, | ||
}, | ||
{ | ||
plugins: { | ||
"testing-library": fixupPluginRules({ | ||
rules: testingLibrary.rules, | ||
}), | ||
}, | ||
files: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"], | ||
rules: { | ||
...testingLibrary.configs["flat/react"].rules, | ||
"testing-library/no-node-access": "off", | ||
"testing-library/no-container": "off", | ||
"testing-library/no-render-in-lifecycle": "off", | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.