diff --git a/eslint-config/.eslintrc-premium.json b/eslint-config/.eslintrc-premium.json new file mode 100644 index 0000000000..c723edcf07 --- /dev/null +++ b/eslint-config/.eslintrc-premium.json @@ -0,0 +1,32 @@ +{ + "extends": "airbnb", + "env": { + "browser": true + }, + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 6, + "ecmaFeatures": { + "jsx": true + } + }, + "plugins": [ + "react-hooks" + ], + "settings": { + "import/resolver": "webpack" + }, + "rules": { + // React hooks rules + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn", + // Exceptions + "arrow-parens": ["error", "always"], + "comma-dangle": ["error", "always-multiline"], + "import/extensions": 0, // we wouldn't be able to import jQuery without this line + "jsx-a11y/anchor-is-valid": [ "error", { + "components": [ "Link" ], + "specialLink": [ "to" ] + }] + } +} diff --git a/eslint-config/.eslintrc-premium.ts.json b/eslint-config/.eslintrc-premium.ts.json new file mode 100644 index 0000000000..ec83935f8c --- /dev/null +++ b/eslint-config/.eslintrc-premium.ts.json @@ -0,0 +1,65 @@ +{ + "extends": [ + "airbnb", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ], + "env": { + "amd": true, + "browser": true, + "mocha": true + }, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "tsconfigRootDir": ".", + "project": ["./tsconfig.json"], + "ecmaVersion": 6, + "ecmaFeatures": { + "jsx": true + } + }, + "plugins": [ + "react-hooks", + "no-only-tests", + "@typescript-eslint" + ], + "settings": { + "import/resolver": "webpack" + }, + "rules": { + "no-use-before-define": "off", // disable the original rule, use only the typescript rule on the next line + "@typescript-eslint/no-use-before-define": ["error"], + // PropTypes + "react/prop-types": 0, + "react/jsx-props-no-spreading": 0, + // Hooks + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn", + // Exceptions + "react/jsx-filename-extension": 0, + "arrow-parens": ["error", "always"], + "comma-dangle": ["error", "always-multiline"], + "no-only-tests/no-only-tests": 2, + "no-script-url": 0, + "import/extensions": 0, // we wouldn't be able to import jQuery without this line + "import/prefer-default-export": 0, // we want to stop using default exports and start using named exports + "react/destructuring-assignment": 0, // that would be too many changes to fix this one + "prefer-destructuring": 0, // that would be too many changes to fix this one + "jsx-a11y/label-has-for": [2, { + "required": {"some": ["nesting", "id"]} // some of our labels are hidden and we cannot nest those + }], + "jsx-a11y/anchor-is-valid": 0, // cannot fix this one, it would break wprdpress themes + "jsx-a11y/label-has-associated-control": [ 2, { + "either": "either" // control has to be either nested or associated via htmlFor + }] + }, + "overrides": [ + { + "files": ["**/_stories/*.tsx"], + "rules": { + "import/no-extraneous-dependencies": ["error", { "devDependencies": true }] + } + } + ] +}