mirror of
https://github.com/lensapp/lens.git
synced 2024-11-10 10:36:25 +03:00
9563ead2e6
- Add distinction between `getInstance` and `getInstanceOrCreate` since it is not always possible to create an instance (since you might not know the correct arguments) - Remove all the `export const *Store = *Store.getInstance<*Store>();` calls as it defeats the purpose of `Singleton`. Plus with the typing changes the appropriate `*Store.getInstance()` is "short enough". - Special case the two extension export facades to not need to use `getInstanceOrCreate`. Plus since they are just facades it is always possible to create them. - Move some other types to be also `Singleton`'s: ExtensionLoader, ExtensionDiscovery, ThemeStore, LocalizationStore, ... - Fixed dev-run always using the same port with electron inspect - Update Store documentation with new recommendations about creating instances of singletons - Fix all unit tests to create their dependent singletons Signed-off-by: Sebastian Malton <sebastian@malton.name>
191 lines
6.2 KiB
JavaScript
191 lines
6.2 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,
|
|
}],
|
|
"linebreak-style": ["error", "unix"],
|
|
"eol-last": ["error", "always"],
|
|
"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"]},
|
|
]
|
|
}
|
|
},
|
|
{
|
|
files: [
|
|
"**/*.ts",
|
|
],
|
|
parser: "@typescript-eslint/parser",
|
|
extends: [
|
|
"plugin:@typescript-eslint/recommended",
|
|
],
|
|
plugins: [
|
|
"unused-imports"
|
|
],
|
|
parserOptions: {
|
|
ecmaVersion: 2018,
|
|
sourceType: "module",
|
|
},
|
|
rules: {
|
|
"no-invalid-this": "off",
|
|
"@typescript-eslint/no-invalid-this": ["error"],
|
|
"@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"],
|
|
"linebreak-style": ["error", "unix"],
|
|
"eol-last": ["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"]},
|
|
]
|
|
},
|
|
},
|
|
{
|
|
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: {
|
|
"no-invalid-this": "off",
|
|
"@typescript-eslint/no-invalid-this": ["error"],
|
|
"@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"],
|
|
"linebreak-style": ["error", "unix"],
|
|
"eol-last": ["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"]},
|
|
]
|
|
},
|
|
}
|
|
]
|
|
};
|