From 6085a6c02c9b512417088361236543de6ec6d512 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 21 Aug 2020 10:23:26 -0400 Subject: [PATCH] specify new eslint file Signed-off-by: Sebastian Malton --- .eslintrc.js | 101 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 34 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 516029cdd4..0b339c13c0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,4 @@ -module.exports = { +module.exports = { overrides: [ { files: [ @@ -6,71 +6,104 @@ module.exports = { "build/**/*.js", ], extends: [ - 'eslint:recommended', + "eslint:recommended", ], env: { node: true }, - parserOptions: { + parserOptions: { ecmaVersion: 2018, sourceType: 'module', }, rules: { "indent": ["error", 2], "no-unused-vars": "off", + "semi": ["error", "never"], } }, { files: [ + "src/renderer/**/*.tsx", "build/*.ts", "src/**/*.ts", "integration/**/*.ts" ], parser: "@typescript-eslint/parser", - extends: [ - 'plugin:@typescript-eslint/recommended', + plugins: [ + "react", ], - parserOptions: { - ecmaVersion: 2018, - sourceType: 'module', - }, - rules: { - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": "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", - "indent": ["error", 2] - }, - }, - { - files: [ - "src/renderer/**/*.tsx", + extends: [ + "plugin:@typescript-eslint/recommended", + "plugin:react/recommended", ], - parser: "@typescript-eslint/parser", - extends: [ - 'plugin:@typescript-eslint/recommended', - ], - parserOptions: { + parserOptions: { ecmaVersion: 2018, sourceType: 'module', jsx: true, }, + settings: { + react: { + version: "16.13", + }, + }, rules: { "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/interface-name-prefix": "off", - "@typescript-eslint/no-use-before-define": "off", + "no-unused-vars": "off", + "comma-dangle": ["error", "always-multiline"], + "object-shorthand": ["error", "always"], + "@typescript-eslint/no-unused-vars": [ + "error", + { + "varsIgnorePattern": "^_", + "argsIgnorePattern": "^_", + "ignoreRestSiblings": true, + } + ], + "quotes": [ + "error", + "double", + { + "avoidEscape": true, + } + ], + "prefer-template": "error", + "no-useless-concat": "error", + "@typescript-eslint/no-use-before-define": [ + "error", + { + "functions": false, + "classes": false, + } + ], "@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/explicit-module-boundary-types": ["error"], + "@typescript-eslint/ban-types": ["error"], "@typescript-eslint/no-empty-function": "off", - "indent": ["error", 2] + "@typescript-eslint/naming-convention": [ + "error", + { + "selector": "interface", + "format": ["PascalCase"], + "custom": { + "regex": "^I[A-Z]", + "match": false, + }, + } + ], + "indent": [ + "error", + 2, + { + "SwitchCase": 1, + } + ], + "semi": ["error", "never"], + "react/jsx-uses-react": "error", + "react/jsx-uses-vars": "error", + "react/no-set-state": "error", }, } ]