Skip to content

Instantly share code, notes, and snippets.

@Milly
Last active June 9, 2020 07:35
Show Gist options
  • Save Milly/39c99580e5eb7e435d712f7f59db7536 to your computer and use it in GitHub Desktop.
Save Milly/39c99580e5eb7e435d712f7f59db7536 to your computer and use it in GitHub Desktop.
{
"root": true,
"env": {
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier",
"import",
"simple-import-sort"
],
"settings": {
"import/resolver": {
"node": {
"moduleDirectory": [
"node_modules",
"src"
]
}
}
},
"rules": {
"prettier/prettier": "warn",
"simple-import-sort/sort": ["warn", {
"groups": [
["^test/(?!fixtures/)", "^test/fixtures/"],
["^\\u0000"],
["^(?!app/|lib/)@?\\w"],
["^[^.]"],
["^\\."]
]
}],
"import/first": "error",
"import/newline-after-import": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_" }],
"@typescript-eslint/member-ordering": ["warn", {
"default": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}],
"no-restricted-imports": ["error",
{
"name": "rxjs",
"message": "importing from 'rxjs/Observable' for Observable."
},
{
"name": "rxjs/Rx",
"message": "importing from 'rxjs/Observable' for Observable."
}
],
"no-console": "error",
"no-fallthrough": "error"
},
"overrides": [
{
"files": [
"src/**/*.spec.ts"
],
"rules": {
"no-console": ["warn", {"allow": [
"error",
"info",
"log",
"trace",
"warn"
]}],
"@typescript-eslint/no-empty-function": "off"
}
},
{
"files": [
"src/**/*.spec.ts"
],
"rules": {
"no-restricted-globals": ["error",
{
"name": "fdescribe",
"message": "Do not commit fdescribe. Use describe instead."
},
{
"name": "fit",
"message": "Do not commit fit. Use describe instead."
},
{
"name": "xdescribe",
"message": "Do not commit xdescribe. Use describe instead."
},
{
"name": "xit",
"message": "Do not commit xit. Use describe instead."
}
]
}
}
]
}
@Milly
Copy link
Author

Milly commented Jun 9, 2020

Using with angular 9.

Install packages.

npm un tslint
npm i -D eslint prettier eslint-config-prettier eslint-plugin-import eslint-plugin-prettier eslint-plugin-simple-import-sort @typescript-eslint/eslint-plugin @typescript-eslint/parser

Add run-scripts to package.json.

"scripts": {
  "lint": "eslint src --ext .ts",
  "format": "eslint src --ext .ts --fix",
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment