Skip to content

Instantly share code, notes, and snippets.

@JCron245
Last active August 13, 2019 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JCron245/3f2516f423a12acc8045c238ca02bbd1 to your computer and use it in GitHub Desktop.
Save JCron245/3f2516f423a12acc8045c238ca02bbd1 to your computer and use it in GitHub Desktop.
{
"extends": "stylelint-config-recommended-scss",
"rules": {
"selector-type-no-unknown": [true, {
"ignore": ["custom-elements"]
}],
"no-descending-specificity": null
}
}

Husky

Make sure you install the package with yarn or lint and add it to your package.json as well as adding the following config to your package.json file.

"husky": {
	"hooks": {
		"pre-commit": "npm run lint && npm run stylelint",
		"pre-push": "ng build --prod"
	}
}

pre-commit

"pre-commit": "npm run lint && npm run stylelint",

This runs before the GIT commit happens and won't allow the commit to happen if an error is thrown.

pre-push

"pre-push": "ng build --prod"

This runs before the GIT push happens and won't allow the push to happen if an error is thrown.

Stylelint

I left the stylelint stuff in that stripped down package.json I included as we have really enjoyed it for linting our SCSS, I think it has plugins for LESS as well if you guys are using that. Mostly we use the default rules for that.

TSLint

I am not really sure where we got the original set of rules that we use in our TSLint but we have modified them to a small degree to behave how we want. Off the top of my head the important ones it enforces are; tabstop of 2, single quotes, optional semicolons are required, throws a warning on implicit any types, curly braces required.

{
"name": "elevated-tagging-station",
"version": "0.1.0",
"scripts": {
"start": "node server.js",
"lint": "ng lint",
"stylelint": "stylelint \"**/*.scss\""
},
"private": true,
"dependencies": {
...
},
"devDependencies": {
"husky": "^2.7.0",
"stylelint": "^9.10.1",
"stylelint-config-recommended-scss": "^3.3.0",
"stylelint-scss": "^3.9.3",
"tslint": "^5.18.0",
},
"engines": {
"node": ">=7.0.0"
},
"husky": {
"hooks": {
"pre-commit": "npm run lint && npm run stylelint",
"pre-push": "ng build --prod"
}
}
}
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"import-blacklist": [
true
],
"import-spacing": true,
"indent": [
true,
"tabs",
2
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"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": [
false,
"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-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"
}
],
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"no-output-on-prefix": true,
"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
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment