Add eslintrc and all necessary dependencies to handle linting javascript/typescript

- Add engines to specify the engines needed to build and run the project.
- Add browserslist to dynamically handle our supported browsers with for all our automated tooling and inspections.
- Add typescript-eslint/eslint-plugin and typescript-eslint/parser to handle typescript parsing.
- Add eslint-plugin-compat to share configurations between our automated tools.
- Add eslint-plugin-import in order to create an eslint that matches our existing tslint config without losing functionality.
- Add eslint-plugin-jsdoc in order to create an eslint that matches our current tslint config without losing functionality.
- Add eslint-plugin-jasmine to provide support for jasmine testing.
- Removed unused tslint.json
This commit is contained in:
Dillon-Brown 2020-02-10 12:11:39 +00:00
parent 86793924e9
commit 0df81cbb98
6 changed files with 1303 additions and 305 deletions

202
.eslintrc.js Normal file
View file

@ -0,0 +1,202 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true,
"jasmine": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:compat/recommended",
"plugin:import/warnings",
"plugin:import/errors",
"plugin:jsdoc/recommended",
"plugin:jasmine/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./core/app/tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"import",
"jsdoc",
"prefer-arrow",
"jasmine"
],
"rules": {
"@typescript-eslint/array-type": "off",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/indent": [
"error",
4,
{
"FunctionDeclaration": {
"parameters": "first"
},
"FunctionExpression": {
"parameters": "first"
}
}
],
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-delimiter-style": [
"error",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/quotes": [
"error",
"single"
],
"@typescript-eslint/semi": [
"error",
"always"
],
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": "error",
"arrow-parens": [
"off",
"as-needed"
],
"camelcase": "error",
"comma-dangle": "off",
"complexity": "off",
"constructor-super": "error",
"curly": "error",
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"id-blacklist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined"
],
"id-match": "error",
"import/no-deprecated": "warn",
"import/order": "off",
"jsdoc/no-types": "error",
"max-classes-per-file": "off",
"max-len": [
"error",
{
"code": 140
}
],
"new-parens": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": [
"error",
{
"allow": [
"log",
"dirxml",
"warn",
"error",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupCollapsed",
"groupEnd",
"table",
"Console",
"markTimeline",
"profile",
"profileEnd",
"timeline",
"timelineEnd",
"timeStamp",
"context"
]
}
],
"no-debugger": "error",
"no-empty": "off",
"no-eval": "error",
"no-fallthrough": "error",
"no-invalid-this": "off",
"no-multiple-empty-lines": "off",
"no-new-wrappers": "error",
"no-restricted-imports": [
"error",
"rxjs/Rx"
],
"no-shadow": [
"error",
{
"hoist": "all"
}
],
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-underscore-dangle": "error",
"no-unsafe-finally": "error",
"no-unused-expressions": "error",
"no-unused-labels": "error",
"object-shorthand": "error",
"one-var": [
"error",
"never"
],
"prefer-arrow/prefer-arrow-functions": "error",
"quote-props": [
"error",
"as-needed"
],
"radix": "error",
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"asyncArrow": "always",
"named": "never"
}
],
"spaced-comment": "error",
"use-isnan": "error",
"valid-typeof": "off"
}
};

View file

@ -93,15 +93,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"core/app/tsconfig.app.json",
"core/app/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
"eslintConfig": "./.eslintrc.js",
"tsConfig": "core/app/tsconfig.app.json",
"fix": true
}
}
}
@ -122,15 +118,6 @@
"devServerTarget": "SuiteCRM:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "core/app/e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
@ -145,4 +132,4 @@
"prefix": "app"
}
}
}
}

View file

@ -1,12 +0,0 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

1279
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,12 @@
"e2e": "ng e2e"
},
"private": true,
"engines": {
"node": ">= 10.0.0"
},
"browserslist": [
"defaults"
],
"dependencies": {
"@angular/animations": "^8.2.14",
"@angular/cdk": "^8.2.3",
@ -45,13 +51,21 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.25",
"@angular-eslint/builder": "0.0.1-alpha.18",
"@angular/cli": "^8.3.25",
"@angular/compiler-cli": "^8.2.14",
"@angular/language-service": "^8.2.14",
"@types/jasmine": "^3.5.3",
"@types/jasminewd2": "^2.0.6",
"@types/node": "^10.17.14",
"codelyzer": "^5.0.1",
"@typescript-eslint/eslint-plugin": "^2.19.0",
"@typescript-eslint/parser": "^2.19.0",
"eslint": "^6.8.0",
"eslint-plugin-compat": "^3.5.1",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jasmine": "^4.1.0",
"eslint-plugin-jsdoc": "^21.0.0",
"eslint-plugin-prefer-arrow": "^1.1.7",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^4.0.0",
@ -63,7 +77,6 @@
"prettier": "^1.16.1",
"protractor": "^5.4.3",
"ts-node": "^8.6.2",
"tslint": "^5.12.1",
"typescript": "~3.5.3"
}
}

View file

@ -1,75 +0,0 @@
{
"extends": "tslint:recommended",
"rulesDirectory": [
"codelyzer"
],
"rules": {
"array-type": false,
"arrow-parens": false,
"deprecation": {
"severity": "warn"
},
"import-blacklist": [
true,
"rxjs/Rx"
],
"interface-name": false,
"max-classes-per-file": false,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-consecutive-blank-lines": false,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-empty": false,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-switch-case-fall-through": true,
"no-use-before-declare": true,
"no-var-requires": false,
"object-literal-key-quotes": [
true,
"as-needed"
],
"object-literal-sort-keys": false,
"ordered-imports": false,
"quotemark": [
true,
"single"
],
"trailing-comma": false,
"no-output-on-prefix": true,
"no-inputs-metadata-property": true,
"no-outputs-metadata-property": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-output-rename": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true
}
}