Skip to content

Commit

Permalink
add eslint
Browse files Browse the repository at this point in the history
(cherry picked from commit fae486e6798b83f266322d4e95c554a364f479d9)
(cherry picked from commit 52119abfedb111a09a60daec258c6bbc65868932)
  • Loading branch information
Olga Larina committed Sep 13, 2021
1 parent 45f4888 commit a8270a1
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
**/*.js
149 changes: 149 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"no-console": 2, // Remember, this means error!
"indent": [
"error",
2,
{
"SwitchCase": 1,
"MemberExpression": 1,
"CallExpression": {
"arguments": 1
}
}
],
"no-trailing-spaces": "error",
"no-multi-spaces": "error",
"block-spacing": "error",
"comma-spacing": "error",
"key-spacing": "error",
"semi-spacing": "error",
"object-curly-spacing": [
"error",
"always"
],
"space-before-blocks": [
"error",
"always"
],
"space-in-parens": [
"error",
"never"
],
"array-bracket-spacing": [
"error",
"never"
],
"computed-property-spacing": "error",
// "keyword-spacing": ["error", {
// "overrides": {
// "if": { "after": false },
// "for": { "after": false },
// "while": { "after": false },
// "switch": { "after": false },
// //"this": { "after": false, "before": false },
// "new": { "before": false },
// "function": { "after": false, "before": false },
// "catch": { "after": false }
// }
// }],
"no-multiple-empty-lines": [
"error",
{
"max": 1
}
],
"no-whitespace-before-property": "error",
// sub group: semicolons
"semi": [
"error",
"always"
],
"semi": "error",
"no-extra-semi": [
"error"
],
"@typescript-eslint/member-delimiter-style": [
"error",
{
"multiline": {
"delimiter": "comma",
"requireLast": true
},
"singleline": {
"delimiter": "comma",
"requireLast": false
},
"overrides": {
"interface": {
"multiline": {
"delimiter": "semi",
"requireLast": true
}
}
}
}
],
"no-case-declarations": "off",
"quotes": [
"error",
"double",
{
"avoidEscape": true
}
],
"no-useless-escape": "off",
// group: add in future
"@typescript-eslint/no-var-requires": "off", // TODO add ignores
"no-unexpected-multiline": "off",
"no-constant-condition": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/class-name-casing": "off",
"@typescript-eslint/camelcase": "off",
"no-extra-boolean-cast": "off",
//sub group: js native functions
"no-prototype-builtins": "off",
"prefer-spread": "off",
//sub group: var definition:
"no-var": "off",
"prefer-const": "off",
"@typescript-eslint/no-use-before-define": "off",
"no-unsafe-finally": "off",
//"curly": [ "error", "multi-line", "consistent" ],
//"eqeqeq": ["error", "allow-null"],
"@typescript-eslint/no-unused-vars": "off",
// group: add in very far future
//"no-eval": "error",
//"no-extend-native": "error",
"@typescript-eslint/interface-name-prefix": "off",
"prefer-rest-params": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/consistent-type-assertions": "off",
"@typescript-eslint/no-inferrable-types": "off",
// group: usless rules
"no-empty": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-types": "off",
// group: ok
//"@typescript-eslint/consistent-type-assertions": [ "error", { "assertionStyle": "angle-bracket" }],
"linebreak-style": [
"off",
"windows"
]
}
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"doc_update": "chmod +x ./docupdate_npm.sh && ./docupdate_npm.sh",
"build_dev": "webpack --env.buildType dev --env.platform pdf",
"build_prod": "npm run build_dev && webpack --env.buildType prod --env.platform pdf && npm run dts_clean",
"dts_clean": "node dts_cleaner.js"
"dts_clean": "node dts_cleaner.js",
"lint": "eslint ./src"
},
"repository": {
"type": "git",
Expand All @@ -27,8 +28,11 @@
"@types/jest": "^23.3.3",
"@types/lodash": "4.14.121",
"@types/node": "7.0.4",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/parser": "^4.31.0",
"dotenv": "4.0.0",
"dts-bundle": "0.7.2",
"eslint": "^7.32.0",
"generate-json-webpack-plugin": "0.2.1",
"husky": "^2.7.0",
"jest": "^23.6.0",
Expand Down

0 comments on commit a8270a1

Please sign in to comment.