2021-05-17 16:43:53 +03:00
|
|
|
/**
|
2022-01-18 11:18:10 +03:00
|
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
2021-05-17 16:43:53 +03:00
|
|
|
*/
|
|
|
|
|
2020-11-27 16:48:38 +03:00
|
|
|
const packageJson = require("./package.json");
|
|
|
|
|
2020-11-19 23:15:49 +03:00
|
|
|
module.exports = {
|
2020-11-23 20:55:00 +03:00
|
|
|
ignorePatterns: [
|
|
|
|
"**/node_modules/**/*",
|
|
|
|
"**/dist/**/*",
|
2020-12-02 12:22:10 +03:00
|
|
|
"**/static/**/*",
|
2021-08-19 21:29:18 +03:00
|
|
|
"**/site/**/*",
|
2022-01-29 15:46:37 +03:00
|
|
|
"extensions/*/*.tgz",
|
2020-11-23 20:55:00 +03:00
|
|
|
],
|
2020-11-27 16:48:38 +03:00
|
|
|
settings: {
|
|
|
|
react: {
|
|
|
|
version: packageJson.devDependencies.react || "detect",
|
2021-11-03 00:38:20 +03:00
|
|
|
},
|
2020-11-27 16:48:38 +03:00
|
|
|
},
|
2020-03-15 10:52:02 +03:00
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: [
|
2021-11-03 00:38:20 +03:00
|
|
|
"**/*.js",
|
2020-03-15 10:52:02 +03:00
|
|
|
],
|
|
|
|
extends: [
|
2020-11-27 16:48:38 +03:00
|
|
|
"eslint:recommended",
|
2020-03-15 10:52:02 +03:00
|
|
|
],
|
|
|
|
env: {
|
2021-11-03 00:38:20 +03:00
|
|
|
node: true,
|
2020-03-15 10:52:02 +03:00
|
|
|
},
|
2020-11-19 23:15:49 +03:00
|
|
|
parserOptions: {
|
2020-03-15 10:52:02 +03:00
|
|
|
ecmaVersion: 2018,
|
2020-11-27 16:48:38 +03:00
|
|
|
sourceType: "module",
|
2020-03-15 10:52:02 +03:00
|
|
|
},
|
2020-11-27 16:48:38 +03:00
|
|
|
plugins: [
|
2021-05-17 16:43:53 +03:00
|
|
|
"header",
|
|
|
|
"unused-imports",
|
2021-11-03 00:38:20 +03:00
|
|
|
"react-hooks",
|
2020-11-27 16:48:38 +03:00
|
|
|
],
|
2020-03-15 10:52:02 +03:00
|
|
|
rules: {
|
2022-01-07 16:38:21 +03:00
|
|
|
"no-constant-condition": ["error", { "checkLoops": false }],
|
2021-05-17 16:43:53 +03:00
|
|
|
"header/header": [2, "./license-header"],
|
2021-11-03 00:38:20 +03:00
|
|
|
"comma-dangle": ["error", "always-multiline"],
|
|
|
|
"comma-spacing": "error",
|
2020-11-19 23:15:49 +03:00
|
|
|
"indent": ["error", 2, {
|
|
|
|
"SwitchCase": 1,
|
|
|
|
}],
|
2020-03-15 10:52:02 +03:00
|
|
|
"no-unused-vars": "off",
|
2021-11-01 15:37:49 +03:00
|
|
|
"space-before-function-paren": ["error", {
|
|
|
|
"anonymous": "always",
|
|
|
|
"named": "never",
|
|
|
|
"asyncArrow": "always",
|
|
|
|
}],
|
2020-11-27 16:48:38 +03:00
|
|
|
"unused-imports/no-unused-imports": "error",
|
|
|
|
"unused-imports/no-unused-vars": [
|
|
|
|
"warn", {
|
|
|
|
"vars": "all",
|
|
|
|
"args": "after-used",
|
|
|
|
"ignoreRestSiblings": true,
|
2021-11-03 00:38:20 +03:00
|
|
|
},
|
2020-11-27 16:48:38 +03:00
|
|
|
],
|
|
|
|
"quotes": ["error", "double", {
|
|
|
|
"avoidEscape": true,
|
|
|
|
"allowTemplateLiterals": true,
|
|
|
|
}],
|
2021-11-01 15:45:45 +03:00
|
|
|
"object-curly-spacing": ["error", "always", {
|
|
|
|
"objectsInObjects": false,
|
|
|
|
"arraysInObjects": true,
|
|
|
|
}],
|
2021-01-21 16:09:41 +03:00
|
|
|
"linebreak-style": ["error", "unix"],
|
|
|
|
"eol-last": ["error", "always"],
|
2020-11-19 17:34:59 +03:00
|
|
|
"semi": ["error", "always"],
|
2020-11-24 14:16:35 +03:00
|
|
|
"object-shorthand": "error",
|
2020-11-30 16:35:16 +03:00
|
|
|
"prefer-template": "error",
|
|
|
|
"template-curly-spacing": "error",
|
2021-11-01 15:37:37 +03:00
|
|
|
"no-unused-expressions": "error",
|
2020-12-02 10:55:52 +03:00
|
|
|
"padding-line-between-statements": [
|
|
|
|
"error",
|
|
|
|
{ "blankLine": "always", "prev": "*", "next": "return" },
|
|
|
|
{ "blankLine": "always", "prev": "*", "next": "block-like" },
|
|
|
|
{ "blankLine": "always", "prev": "*", "next": "function" },
|
|
|
|
{ "blankLine": "always", "prev": "*", "next": "class" },
|
|
|
|
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
|
2021-11-01 15:45:45 +03:00
|
|
|
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
|
2021-11-01 15:37:29 +03:00
|
|
|
],
|
|
|
|
"no-template-curly-in-string": "error",
|
2021-11-03 00:38:20 +03:00
|
|
|
},
|
2020-03-15 10:52:02 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
files: [
|
2020-11-27 16:48:38 +03:00
|
|
|
"**/*.ts",
|
2022-01-29 15:46:37 +03:00
|
|
|
"**/*.tsx",
|
2020-03-15 10:52:02 +03:00
|
|
|
],
|
|
|
|
parser: "@typescript-eslint/parser",
|
2020-11-19 23:15:49 +03:00
|
|
|
extends: [
|
2022-01-07 16:38:21 +03:00
|
|
|
"eslint:recommended",
|
2020-11-27 16:48:38 +03:00
|
|
|
"plugin:@typescript-eslint/recommended",
|
2022-01-29 15:46:37 +03:00
|
|
|
"plugin:react/recommended",
|
2022-01-05 19:35:44 +03:00
|
|
|
"plugin:import/recommended",
|
|
|
|
"plugin:import/typescript",
|
2020-11-27 16:48:38 +03:00
|
|
|
],
|
|
|
|
plugins: [
|
2021-05-17 16:43:53 +03:00
|
|
|
"header",
|
2021-11-03 00:38:20 +03:00
|
|
|
"unused-imports",
|
2022-01-29 15:46:37 +03:00
|
|
|
"react-hooks",
|
2020-03-15 10:52:02 +03:00
|
|
|
],
|
2020-11-19 23:15:49 +03:00
|
|
|
parserOptions: {
|
2020-03-15 10:52:02 +03:00
|
|
|
ecmaVersion: 2018,
|
2020-11-27 16:48:38 +03:00
|
|
|
sourceType: "module",
|
2020-03-15 10:52:02 +03:00
|
|
|
},
|
|
|
|
rules: {
|
2022-01-29 15:46:37 +03:00
|
|
|
"no-constant-condition": ["error", {
|
|
|
|
"checkLoops": false,
|
2020-11-19 23:15:49 +03:00
|
|
|
}],
|
2021-05-17 16:43:53 +03:00
|
|
|
"header/header": [2, "./license-header"],
|
2022-01-05 19:35:44 +03:00
|
|
|
"react/prop-types": "off",
|
2021-04-21 16:59:59 +03:00
|
|
|
"no-invalid-this": "off",
|
|
|
|
"@typescript-eslint/no-invalid-this": ["error"],
|
2020-03-15 10:52:02 +03:00
|
|
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
|
|
"@typescript-eslint/no-explicit-any": "off",
|
|
|
|
"@typescript-eslint/interface-name-prefix": "off",
|
|
|
|
"@typescript-eslint/no-use-before-define": "off",
|
|
|
|
"@typescript-eslint/no-empty-interface": "off",
|
|
|
|
"@typescript-eslint/no-var-requires": "off",
|
|
|
|
"@typescript-eslint/ban-ts-ignore": "off",
|
2020-06-26 12:05:41 +03:00
|
|
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
|
|
"@typescript-eslint/ban-types": "off",
|
2022-01-29 15:46:37 +03:00
|
|
|
"@typescript-eslint/ban-ts-comment": "off",
|
2020-06-26 12:05:41 +03:00
|
|
|
"@typescript-eslint/no-empty-function": "off",
|
2020-11-27 16:48:38 +03:00
|
|
|
"@typescript-eslint/no-unused-vars": "off",
|
2022-02-16 22:43:03 +03:00
|
|
|
"@typescript-eslint/member-delimiter-style": ["error", {
|
|
|
|
"multiline": {
|
|
|
|
"delimiter": "semi",
|
|
|
|
"requireLast": true,
|
|
|
|
},
|
|
|
|
"singleline": {
|
|
|
|
"delimiter": "semi",
|
|
|
|
"requireLast": false,
|
|
|
|
},
|
|
|
|
}],
|
2022-01-29 15:46:37 +03:00
|
|
|
"react/display-name": "off",
|
2021-11-01 15:37:49 +03:00
|
|
|
"space-before-function-paren": "off",
|
|
|
|
"@typescript-eslint/space-before-function-paren": ["error", {
|
|
|
|
"anonymous": "always",
|
|
|
|
"named": "never",
|
|
|
|
"asyncArrow": "always",
|
|
|
|
}],
|
2022-03-01 21:06:53 +03:00
|
|
|
"@typescript-eslint/naming-convention": ["error",
|
|
|
|
{
|
|
|
|
"selector": "interface",
|
|
|
|
"format": ["PascalCase"],
|
|
|
|
"leadingUnderscore": "forbid",
|
|
|
|
"trailingUnderscore": "forbid",
|
|
|
|
"custom": {
|
|
|
|
"regex": "^Props$",
|
|
|
|
"match": false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"selector": "typeAlias",
|
|
|
|
"format": ["PascalCase"],
|
|
|
|
"leadingUnderscore": "forbid",
|
|
|
|
"trailingUnderscore": "forbid",
|
|
|
|
"custom": {
|
|
|
|
"regex": "^(Props|State)$",
|
|
|
|
"match": false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
2021-08-19 21:29:18 +03:00
|
|
|
"unused-imports/no-unused-imports-ts": process.env.PROD === "true" ? "error" : "warn",
|
2020-11-27 16:48:38 +03:00
|
|
|
"unused-imports/no-unused-vars-ts": [
|
|
|
|
"warn", {
|
|
|
|
"vars": "all",
|
|
|
|
"args": "after-used",
|
|
|
|
"ignoreRestSiblings": true,
|
2021-11-03 00:38:20 +03:00
|
|
|
},
|
2020-11-27 16:48:38 +03:00
|
|
|
],
|
2021-11-03 00:38:20 +03:00
|
|
|
"comman-dangle": "off",
|
|
|
|
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
|
|
|
|
"comma-spacing": "off",
|
|
|
|
"@typescript-eslint/comma-spacing": "error",
|
2020-11-19 23:15:49 +03:00
|
|
|
"indent": ["error", 2, {
|
|
|
|
"SwitchCase": 1,
|
|
|
|
}],
|
2020-11-27 16:48:38 +03:00
|
|
|
"quotes": ["error", "double", {
|
|
|
|
"avoidEscape": true,
|
|
|
|
"allowTemplateLiterals": true,
|
|
|
|
}],
|
2021-11-01 15:45:45 +03:00
|
|
|
"object-curly-spacing": "off",
|
|
|
|
"@typescript-eslint/object-curly-spacing": ["error", "always", {
|
|
|
|
"objectsInObjects": false,
|
|
|
|
"arraysInObjects": true,
|
|
|
|
}],
|
2020-11-19 19:12:28 +03:00
|
|
|
"semi": "off",
|
|
|
|
"@typescript-eslint/semi": ["error"],
|
2021-01-21 16:09:41 +03:00
|
|
|
"linebreak-style": ["error", "unix"],
|
|
|
|
"eol-last": ["error", "always"],
|
2020-11-24 14:16:35 +03:00
|
|
|
"object-shorthand": "error",
|
2020-11-30 16:35:16 +03:00
|
|
|
"prefer-template": "error",
|
|
|
|
"template-curly-spacing": "error",
|
2021-11-01 15:37:37 +03:00
|
|
|
"no-unused-expressions": "off",
|
|
|
|
"@typescript-eslint/no-unused-expressions": "error",
|
2020-12-02 10:55:52 +03:00
|
|
|
"padding-line-between-statements": [
|
|
|
|
"error",
|
|
|
|
{ "blankLine": "always", "prev": "*", "next": "return" },
|
|
|
|
{ "blankLine": "always", "prev": "*", "next": "block-like" },
|
|
|
|
{ "blankLine": "always", "prev": "*", "next": "function" },
|
|
|
|
{ "blankLine": "always", "prev": "*", "next": "class" },
|
|
|
|
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
|
2021-11-01 15:45:45 +03:00
|
|
|
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
|
2021-05-20 19:01:01 +03:00
|
|
|
],
|
|
|
|
"react-hooks/rules-of-hooks": "error",
|
2021-11-01 15:37:29 +03:00
|
|
|
"react-hooks/exhaustive-deps": "off",
|
|
|
|
"no-template-curly-in-string": "error",
|
2022-04-06 17:34:16 +03:00
|
|
|
"@typescript-eslint/consistent-type-imports": "error",
|
2020-03-15 10:52:02 +03:00
|
|
|
},
|
2021-11-03 00:38:20 +03:00
|
|
|
},
|
|
|
|
],
|
2020-03-15 10:52:02 +03:00
|
|
|
};
|