X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=.eslintrc;h=4773a806ae1c15dbd0c4eaac2400a4b71d6b2bc5;hb=08f130a055123f5e47c59e1a64875f8cff44d020;hp=e34e03a96d318d80b28435c21b53dfccce0ea7d3;hpb=8439338184af0caa1b8402d71f4c0aaa131f8ef1;p=e-mobility-charging-stations-simulator.git diff --git a/.eslintrc b/.eslintrc index e34e03a9..4773a806 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,36 +1,158 @@ { - "parser": "babel-eslint", + "root": true, + "env": { + "es2020": true, + "node": true, + "mocha": true + }, + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module" + }, "extends": [ "eslint:recommended", - "plugin:flowtype/recommended", - "node", - "google" - ], - "plugins": [ - "flowtype" + "plugin:import/errors", + "plugin:import/warnings", + "plugin:jsdoc/recommended", + "plugin:prettier/recommended" ], + "plugins": ["import", "jsdoc"], + "settings": { + "jsdoc": { + "mode": "typescript" + } + }, "rules": { - "require-jsdoc": 0, - "import/no-commonjs": [ - 2, + "space-before-blocks": ["error", "always"], + "curly": ["error", "all"], + "brace-style": "error", + "eqeqeq": ["error", "always"], + "no-else-return": "error", + "no-eq-null": "error", + "no-extra-bind": "error", + "no-lone-blocks": "error", + "no-multi-spaces": "error", + "no-empty": "error", + "no-return-assign": ["error", "always"], + "no-useless-catch": "error", + "no-useless-return": "error", + "no-multiple-empty-lines": [ + "error", { - "allowRequire": true, - "allowPrimitiveModules": true + "max": 2, + "maxEOF": 1 } ], - "import/no-nodejs-modules": 0, - "flowtype/no-types-missing-file-annotation": 0, + "block-spacing": "error", + // "capitalized-comments": [ + // "error", + // "always", + // { + // "ignoreConsecutiveComments": true, + // "ignorePattern": "pragma|ignored" + // } + // ], + "eol-last": ["error", "always"], + "consistent-this": ["error", "self"], + "func-call-spacing": ["error", "never"], + "keyword-spacing": ["error"], + "id-blacklist": [ + "error", + "any", + "Number", + "number", + "String", + "string", + "Boolean", + "boolean", + "Undefined", + "undefined", + "Symbol", + "symbol" + ], + "linebreak-style": ["error", "unix"], "max-len": [ "warn", { - "code": 180, - "ignoreComments": true, - "ignoreUrls": true, - "ignoreStrings": true, - "ignoreTemplateLiterals": true, - "ignoreRegExpLiterals": true, - "ignorePattern": "(^(import|export)|(public|private))\\s.+;" + "code": 100, + "ignoreUrls": true + } + ], + "no-lonely-if": "error", + "no-trailing-spaces": "error", + "no-whitespace-before-property": "error", + "space-in-parens": ["error", "never"], + "space-infix-ops": "error", + "space-unary-ops": "error", + "spaced-comment": ["error", "always"], + "switch-colon-spacing": "error", + "arrow-body-style": ["error", "as-needed"], + "arrow-parens": ["error", "always"], + "arrow-spacing": "error", + "no-duplicate-imports": "error", + "no-var": "error", + "prefer-const": "error", + "sort-imports": [ + "warn", + { + "ignoreCase": false, + "ignoreDeclarationSort": false, + "ignoreMemberSort": false, + "memberSyntaxSortOrder": ["none", "all", "multiple", "single"] + } + ], + "object-curly-spacing": ["error", "always"], + "lines-between-class-members": [ + "error", + "always", + { + "exceptAfterSingleLine": true + } + ], + "quotes": [ + "error", + "single", + { + "avoidEscape": true, + "allowTemplateLiterals": false } ] - } + }, + "overrides": [ + { + "files": ["**/*.ts"], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module", + "project": "./tsconfig.json" + }, + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:import/typescript" + ], + "plugins": ["@typescript-eslint"], + "rules": { + "@typescript-eslint/array-type": "off", + "semi": "off", + "@typescript-eslint/semi": ["error", "always"], + "@typescript-eslint/no-empty-function": "warn", + "@typescript-eslint/member-ordering": "error", + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/no-floating-promises": "error", + "@typescript-eslint/promise-function-async": "error", + "@typescript-eslint/no-misused-promises": "error", + "no-shadow": "off", // This one is generating false positive no-shadow errors on exported/const enums + "@typescript-eslint/no-shadow": "error" + } + }, + { + "files": ["**/*.js"], + "extends": "plugin:node/recommended", + "rules": { + "node/shebang": "off" + } + } + ] }