🚨(frontend) create package eslint-config-people
We want to lint the e2e tests, we export the eslint config from the app desk to a package in order to use it for the e2e tests and for our apps.
This commit is contained in:
62
src/frontend/packages/eslint-config-people/common.js
Normal file
62
src/frontend/packages/eslint-config-people/common.js
Normal file
@@ -0,0 +1,62 @@
|
||||
const eslintTS = {
|
||||
files: ["*.ts", "*.tsx"],
|
||||
extends: [
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
],
|
||||
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: ["./tsconfig.json"],
|
||||
},
|
||||
rules: {
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "error",
|
||||
"sort-imports": [
|
||||
"error",
|
||||
{
|
||||
ignoreDeclarationSort: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const globalRules = {
|
||||
"block-scoped-var": "error",
|
||||
curly: ["error", "all"],
|
||||
"import/no-duplicates": ["error", { considerQueryString: false }],
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
alphabetize: {
|
||||
order: "asc",
|
||||
},
|
||||
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
|
||||
pathGroups: [
|
||||
{
|
||||
pattern: "@/**",
|
||||
group: "internal",
|
||||
},
|
||||
],
|
||||
pathGroupsExcludedImportTypes: ["builtin"],
|
||||
"newlines-between": "always",
|
||||
},
|
||||
],
|
||||
"no-alert": "error",
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{ varsIgnorePattern: "^_", argsIgnorePattern: "^_" },
|
||||
],
|
||||
"react/jsx-curly-brace-presence": [
|
||||
"error",
|
||||
{ props: "never", children: "never", propElementValues: "always" },
|
||||
],
|
||||
"sort-imports": [
|
||||
"error",
|
||||
{
|
||||
ignoreDeclarationSort: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = { eslintTS, globalRules };
|
||||
65
src/frontend/packages/eslint-config-people/next.js
Normal file
65
src/frontend/packages/eslint-config-people/next.js
Normal file
@@ -0,0 +1,65 @@
|
||||
const common = require("./common");
|
||||
|
||||
module.exports = {
|
||||
extends: [
|
||||
"next",
|
||||
"plugin:prettier/recommended",
|
||||
"plugin:@tanstack/eslint-plugin-query/recommended",
|
||||
"plugin:jsx-a11y/recommended",
|
||||
],
|
||||
settings: {
|
||||
"jsx-a11y": {
|
||||
polymorphicPropName: "as",
|
||||
components: {
|
||||
Input: "input",
|
||||
Button: "button",
|
||||
Box: "div",
|
||||
Text: "span",
|
||||
Select: "select",
|
||||
},
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
...common.globalRules,
|
||||
"react-hooks/rules-of-hooks": "error",
|
||||
"react-hooks/exhaustive-deps": "error",
|
||||
},
|
||||
overrides: [
|
||||
common.eslintTS,
|
||||
{
|
||||
files: ["*.spec.*", "*.test.*", "**/__mock__/**/*"],
|
||||
plugins: ["jest"],
|
||||
extends: ["plugin:jest/recommended", "plugin:testing-library/react"],
|
||||
rules: {
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-unsafe-argument": "off",
|
||||
"@typescript-eslint/no-unsafe-assignment": "off",
|
||||
"@typescript-eslint/no-unsafe-call": "off",
|
||||
"@typescript-eslint/no-unsafe-member-access": "off",
|
||||
"@typescript-eslint/no-unsafe-return": "off",
|
||||
"testing-library/no-await-sync-events": [
|
||||
"error",
|
||||
{ eventModules: ["fire-event"] },
|
||||
],
|
||||
"testing-library/await-async-events": [
|
||||
"error",
|
||||
{
|
||||
eventModule: "userEvent",
|
||||
},
|
||||
],
|
||||
"testing-library/no-manual-cleanup": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{ varsIgnorePattern: "^_", argsIgnorePattern: "^_" },
|
||||
],
|
||||
"react/display-name": 0,
|
||||
"jest/expect-expect": "error",
|
||||
"@typescript-eslint/unbound-method": "off",
|
||||
"jest/unbound-method": "error",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
18
src/frontend/packages/eslint-config-people/package.json
Normal file
18
src/frontend/packages/eslint-config-people/package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "eslint-config-people",
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tanstack/eslint-plugin-query": "5.17.1",
|
||||
"@typescript-eslint/eslint-plugin": "6.18.1",
|
||||
"eslint": "8.0.1",
|
||||
"eslint-config-next": "14.0.4",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-plugin-jest": "27.6.2",
|
||||
"eslint-plugin-jsx-a11y": "6.8.0",
|
||||
"eslint-plugin-prettier": "5.1.2",
|
||||
"eslint-plugin-testing-library": "6.2.0",
|
||||
"@next/eslint-plugin-next": "14.0.4",
|
||||
"eslint-plugin-playwright": "0.22.1"
|
||||
}
|
||||
}
|
||||
19
src/frontend/packages/eslint-config-people/playwright.js
Normal file
19
src/frontend/packages/eslint-config-people/playwright.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const common = require("./common");
|
||||
|
||||
module.exports = {
|
||||
extends: ["next", "plugin:prettier/recommended"],
|
||||
parserOptions: {
|
||||
babelOptions: {
|
||||
presets: [require.resolve("next/babel")],
|
||||
},
|
||||
},
|
||||
rules: common.globalRules,
|
||||
overrides: [
|
||||
common.eslintTS,
|
||||
{
|
||||
files: ["*.spec.*", "*.test.*", "**/__mock__/**/*"],
|
||||
extends: ["plugin:playwright/recommended"],
|
||||
plugins: ["playwright"],
|
||||
},
|
||||
],
|
||||
};
|
||||
2156
src/frontend/packages/eslint-config-people/yarn.lock
Normal file
2156
src/frontend/packages/eslint-config-people/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user