🔧(lint) setup ESLint package

Add a shared package for ESLint configuration to avoid duplication accross
repos.
This commit is contained in:
Nathan Vasse
2022-12-01 12:02:09 +01:00
committed by NathanVss
parent 2a26279cc2
commit 4803b38d34
2 changed files with 115 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
{
"env": {
"browser": true,
"jest": true,
"es6": true
},
"extends": [
"airbnb",
"airbnb-typescript",
"plugin:compat/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
/*
To use eslint with VSCode and see lint error directly in file,
you have to install dbaeumer.vscode-eslint extension
and you may have to tweak your workspace settings with:
"eslint.workingDirectories": ["src/frontend"]
As frontend is not at the root of the repository,
this setting allows ESLint extension to find the ./tsconfig.json file
*/
"project": "./tsconfig.json",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["formatjs", "@typescript-eslint"],
/* Disable some rules to be iso with tslint which was previously used */
"rules": {
"@typescript-eslint/explicit-member-accessibility": ["error", { "accessibility": "no-public" }],
"@typescript-eslint/lines-between-class-members": "off",
"@typescript-eslint/no-use-before-define": "off",
"arrow-parens": "error",
"consistent-return": "off",
"default-case": "off",
"formatjs/no-multiple-whitespaces": "error",
"formatjs/enforce-description": "error",
"formatjs/enforce-default-message": "error",
"global-require": "off",
"import/extensions": "off",
"import/no-cycle": ["off"],
"import/no-dynamic-require": "off",
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"alphabetize": { "order": "ignore" }
}
],
"import/prefer-default-export": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/label-has-associated-control": "warn",
"no-console": ["error", { "allow": ["warn"] }],
"no-else-return": "off",
"no-empty-function": "off",
"no-nested-ternary": "warn",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-promise-executor-return": "off",
"no-prototype-builtins": "off",
"no-return-assign": "off",
"no-return-await": "off",
"no-undef": "off",
"no-underscore-dangle": "off",
"no-useless-escape": "off",
"prefer-template": "off",
"react/button-has-type": "off",
"react/destructuring-assignment": "off",
"react/function-component-definition": [
"error",
{ "namedComponents": "arrow-function", "unnamedComponents": "arrow-function" }
],
"react/jsx-boolean-value": "off",
"react/jsx-fragments": "off",
"react/jsx-props-no-spreading": "off",
"react/jsx-uses-react": "off",
"react/no-array-index-key": "warn",
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"react/require-default-props": "off",
"react/style-prop-object": ["error", { "allow": ["FormattedNumber"] }]
},
"settings": {
"polyfills": ["fetch", "Promise"],
"import/resolver": "webpack"
}
}

View File

@@ -0,0 +1,26 @@
{
"name": "eslint-config-custom",
"version": "0.0.0",
"license": "MIT",
"main": ".eslintrc.json",
"dependencies": {
"@typescript-eslint/eslint-plugin": "5.42.0",
"@typescript-eslint/parser": "5.42.0",
"eslint": "8.27.0",
"eslint-config-next": "13.0.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-import-resolver-webpack": "0.13.2",
"eslint-plugin-compat": "4.0.2",
"eslint-plugin-formatjs": "4.3.4",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsx-a11y": "6.6.1",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.31.10",
"eslint-plugin-react-hooks": "4.6.0"
},
"publishConfig": {
"access": "public"
}
}