@protoarch.angular/linters
v18.1.1
Published
ESLint, Stylelint & Prettier configs for Angular apps
Downloads
39
Readme
@protoarch.angular/linters
ESlint, Stylelint & Prettier rules for Angular applications.
Setup
Install from npm
npm i @protoarch.angular/linters --save-dev
ESLint + Prettier
Include configurations:
.eslintrc.js
const {join} = require('path');
module.exports = {
root: true,
extends: ['./node_modules/@protoarch.angular/linters/eslint/index.js'],
parserOptions: {
ecmaVersion: 2022,
project: join(__dirname, './tsconfig.json'),
sourceType: 'module',
},
};
.prettierrc.js
module.exports = {
...require('./node_modules/@protoarch.angular/linters/prettier/prettier.config.js'),
};
Add npm-script:
"lint": "npm exec -- eslint --config ./.eslintrc.js --debug "src/**/*.{js,ts,html}"",
"lint:fix": "npm exec -- eslint --config ./.eslintrc.js --fix --debug "src/**/*.{js,ts,html}""
Add .eslintignore
file
dist
node_modules
coverage
*.less
*.css
Stylelint
stylelint.config.js
const styleLint = require('@protoarch.angular/linters/stylelint/stylelint.config.js');
module.exports = {
...styleLint,
rules: {
...styleLint.rules,
'no-empty-source': null,
},
};
Add npm-script:
"lint": "npm exec -- stylelint --config ./.stylelintrc \"src/**/*.less\"",
"lint:fix": "npm exec -- stylelint --config ./.stylelintrc --fix \"src/**/*.less\""
VSCODE
.vscode/settings.json
"stylelint.validate": [
"css",
"less",
"postcss",
"scss"
],
WebStorm
Configure pattern in Preferences > Stylelint
{**/*,*}.{css,less,pcss,scss}