Reputation: 1006
I need to remove below tslint rules from my tslint.json.
In order to remove white-spaces, I removed check-type
by looking at this issue.
But still I'm getting errors when I run ng lint
command on cli. Anyone knows how to remove above rules from my tslint.json file ?
tslint.json
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
false,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs",
"rxjs/Rx"
],
"import-spacing": true,
"indent": [
false,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
200
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false,
"whitespace": [
false,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"invoke-injectable": true
}
}
Upvotes: 0
Views: 3862
Reputation: 1785
1.file should end with a new line
"eofline": true,
2.trailing whitespace
"no-trailing-whitespace": false,
3.Missing Whitespace
"whitespace": [
false,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
4." should be '
"quotemark": [
true,
"single"
],
Upvotes: 1
Reputation: 1485
Here's how I do it in my root folder where my tslint.json file is:
But first change "no-trailing-whitespace": true
, to false
in tslint.json
tslint only warns you. Prettier enforces it. You might want to check out the prettier docs. It took me a while to fine tune mine. Now I just use it in everyone of my application across the board.
.editorconfig
file I have the following which comes with every new Angular app:# Editor configuration, see http://editorconfig.org root = true [*] charset = utf-8 indent_style = space indent_size = 2 insert_final_newline = true trim_trailing_whitespace = true [*.md] max_line_length = off trim_trailing_whitespace = false
{ "arrowParens": "avoid", "bracketSpacing": true, "endOfLine": "auto", "htmlWhitespaceSensitivity": "strict", "semi": true, "singleQuote": true, "tabWidth": 2, "trailingComma": "all", "useTabs": false }
vscode
in extensions.json
(with this whenever you start vs code it will prompt you to install the recommendation:// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp // List of extensions which should be recommended for users of this workspace. { "recommendations": [ "Angular.ng-template", "DavidAnson.vscode-markdownlint", "eamodio.gitlens", "EditorConfig.EditorConfig", "esbenp.prettier-vscode", "mike-co.import-sorter", "ms-vscode.vscode-typescript-tslint-plugin" ], "unwantedRecommendations": [ "amatiasq.sort-imports", "eg2.tslint", "HookyQR.beautify" ] }
package.json
add these then do npm install
:"prettier": "1.18.2", "protractor": "5.4.2", "tslint-config-prettier": "1.18.0", "tslint-consistent-codestyle": "1.16.0", "tslint-plugin-prettier": "2.0.1",
{ "defaultSeverity": "error", "extends": [ "tslint:latest", "tslint-config-prettier", "tslint-consistent-codestyle" ], "rules": {...
Upvotes: 1
Reputation: 6821
Remove in your tsLint :
"no-trailing-whitespace": true,
"whitespace": [
false,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"quotemark": [
true,
"single"
],
"eofline": true,
Upvotes: 0