2021-05-17 16:43:53 +03:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2021 OpenLens Authors
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
|
* this software and associated documentation files (the "Software"), to deal in
|
|
|
|
* the Software without restriction, including without limitation the rights to
|
|
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
|
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
|
|
* subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
|
|
* copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
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/**/*",
|
2020-11-23 20:55:00 +03:00
|
|
|
],
|
2020-11-27 16:48:38 +03:00
|
|
|
settings: {
|
|
|
|
react: {
|
|
|
|
version: packageJson.devDependencies.react || "detect",
|
|
|
|
}
|
|
|
|
},
|
2020-03-15 10:52:02 +03:00
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: [
|
2020-11-27 16:48:38 +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: {
|
|
|
|
node: true
|
|
|
|
},
|
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",
|
2020-11-27 16:48:38 +03:00
|
|
|
],
|
2020-03-15 10:52:02 +03:00
|
|
|
rules: {
|
2021-05-17 16:43:53 +03:00
|
|
|
"header/header": [2, "./license-header"],
|
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",
|
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,
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"quotes": ["error", "double", {
|
|
|
|
"avoidEscape": true,
|
|
|
|
"allowTemplateLiterals": 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",
|
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": "*" },
|
|
|
|
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]},
|
|
|
|
]
|
2020-03-15 10:52:02 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: [
|
2020-11-27 16:48:38 +03:00
|
|
|
"**/*.ts",
|
2020-03-15 10:52:02 +03:00
|
|
|
],
|
|
|
|
parser: "@typescript-eslint/parser",
|
2020-11-19 23:15:49 +03:00
|
|
|
extends: [
|
2020-11-27 16:48:38 +03:00
|
|
|
"plugin:@typescript-eslint/recommended",
|
|
|
|
],
|
|
|
|
plugins: [
|
2021-05-17 16:43:53 +03:00
|
|
|
"header",
|
2020-11-27 16:48:38 +03:00
|
|
|
"unused-imports"
|
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: {
|
2021-05-17 16:43:53 +03:00
|
|
|
"header/header": [2, "./license-header"],
|
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",
|
2020-06-30 14:35:16 +03:00
|
|
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
|
|
"@typescript-eslint/ban-types": "off",
|
|
|
|
"@typescript-eslint/ban-ts-comment": "off",
|
|
|
|
"@typescript-eslint/no-empty-interface": "off",
|
2020-11-27 16:48:38 +03:00
|
|
|
"@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,
|
|
|
|
}
|
|
|
|
],
|
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,
|
|
|
|
}],
|
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",
|
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": "*" },
|
|
|
|
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]},
|
|
|
|
]
|
2020-03-15 10:52:02 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: [
|
2020-11-27 16:48:38 +03:00
|
|
|
"**/*.tsx",
|
2020-03-15 10:52:02 +03:00
|
|
|
],
|
|
|
|
parser: "@typescript-eslint/parser",
|
2020-11-27 16:48:38 +03:00
|
|
|
plugins: [
|
2021-05-17 16:43:53 +03:00
|
|
|
"header",
|
2020-11-27 16:48:38 +03:00
|
|
|
"unused-imports"
|
|
|
|
],
|
2020-11-19 23:15:49 +03:00
|
|
|
extends: [
|
2020-11-27 16:48:38 +03:00
|
|
|
"plugin:@typescript-eslint/recommended",
|
|
|
|
"plugin:react/recommended",
|
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
|
|
|
jsx: true,
|
|
|
|
},
|
|
|
|
rules: {
|
2021-05-17 16:43:53 +03:00
|
|
|
"header/header": [2, "./license-header"],
|
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",
|
|
|
|
"@typescript-eslint/no-empty-function": "off",
|
2020-11-27 16:48:38 +03:00
|
|
|
"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,
|
|
|
|
}
|
|
|
|
],
|
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,
|
|
|
|
}],
|
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",
|
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": "*" },
|
|
|
|
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]},
|
|
|
|
]
|
2020-03-15 10:52:02 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|