1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/.eslintrc.js
Panu Horsmalahti f65861bfee Add eslint no-trailing-spaces, quote-props, space-infix-ops and arrow-parens rules
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
2020-12-03 10:36:37 +02:00

195 lines
6.4 KiB
JavaScript

const packageJson = require("./package.json");
module.exports = {
ignorePatterns: [
"**/node_modules/**/*",
"**/dist/**/*",
"**/static/**/*",
],
settings: {
react: {
version: packageJson.devDependencies.react || "detect",
}
},
overrides: [
{
files: [
"**/*.js"
],
extends: [
"eslint:recommended",
],
env: {
node: true
},
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
plugins: [
"unused-imports"
],
rules: {
"indent": ["error", 2, {
SwitchCase: 1,
}],
"no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn", {
vars: "all",
args: "after-used",
ignoreRestSiblings: true,
}
],
"quotes": ["error", "double", {
avoidEscape: true,
allowTemplateLiterals: true,
}],
"semi": ["error", "always"],
"object-shorthand": "error",
"prefer-template": "error",
"template-curly-spacing": "error",
"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: "*" },
{ blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"]},
],
"no-trailing-spaces": "error",
"quote-props": ["error", "consistent-as-needed"],
"space-infix-ops": ["error", { int32Hint: false }],
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }]
}
},
{
files: [
"**/*.ts",
],
parser: "@typescript-eslint/parser",
extends: [
"plugin:@typescript-eslint/recommended",
],
plugins: [
"unused-imports"
],
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports-ts": "error",
"unused-imports/no-unused-vars-ts": [
"warn", {
vars: "all",
args: "after-used",
ignoreRestSiblings: true,
}
],
"indent": ["error", 2, {
SwitchCase: 1,
}],
"quotes": ["error", "double", {
avoidEscape: true,
allowTemplateLiterals: true,
}],
"semi": "off",
"@typescript-eslint/semi": ["error"],
"object-shorthand": "error",
"prefer-template": "error",
"template-curly-spacing": "error",
"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: "*" },
{ blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"]},
],
"no-trailing-spaces": "error",
"quote-props": ["error", "consistent-as-needed"],
"space-infix-ops": "off",
"@typescript-eslint/space-infix-ops": ["error", { int32Hint: false }],
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }]
},
},
{
files: [
"**/*.tsx",
],
parser: "@typescript-eslint/parser",
plugins: [
"unused-imports"
],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
],
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
jsx: true,
},
rules: {
"@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",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-empty-function": "off",
"react/display-name": "off",
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports-ts": "error",
"unused-imports/no-unused-vars-ts": [
"warn", {
vars: "all",
args: "after-used",
ignoreRestSiblings: true,
}
],
"indent": ["error", 2, {
SwitchCase: 1,
}],
"quotes": ["error", "double", {
avoidEscape: true,
allowTemplateLiterals: true,
}],
"semi": "off",
"@typescript-eslint/semi": ["error"],
"object-shorthand": "error",
"prefer-template": "error",
"template-curly-spacing": "error",
"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: "*" },
{ blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"]},
],
"no-trailing-spaces": "error",
"quote-props": ["error", "consistent-as-needed"],
"space-infix-ops": "off",
"@typescript-eslint/space-infix-ops": ["error", { int32Hint: false }],
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }]
},
}
]
};