Lint-a-lot is an opinionated ESLint and Stylelint configuration for Angular projects using modern Flat Config.
Also this project contains a .editorconfig that should be used.
Add dependency
npm i --save-dev @j1n/lint-a-lotThis lib supports .cjs and .mjs.
In eslint.config.js:
const lal = require("@j1n/lint-a-lot");
module.exports = [
...lal.esLintConfig.configs.angular.tsRecommended,
...lal.esLintConfig.configs.shared.testingVitestRecommended,
...lal.esLintConfig.configs.angular.htmlRecommended,
];import lal from '@j1n/lint-a-lot';
export default [
...lal.esLintConfig.configs.angular.tsRecommended,
...lal.esLintConfig.configs.shared.testingVitestRecommended,
...lal.esLintConfig.configs.angular.htmlRecommended,
]Check if you have a builder for eslint in your angular.json:
{
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html",
"e2e/**/*.ts"
]
}
}
}In stylelint.config.js:
const lal = require("@j1n/lint-a-lot");
module.exports = lal.stylelintConfig;import lal from '@j1n/lint-a-lot';
export default lal.stylelintConfig;Move the .editorconfig file to the root of you project.
See IDE-setup.
If you want to test this library you can use npm pack. This will result in the creation of a .tgz-file.
- Go to the project where you want to use lint-a-lot.
- Open
package.json - Add lint-a-lot to
devDependencies->json "@j1n/lint-a-lot": "file:<PATH_TO_YOUR_TGZ_FILE>", - Remove
node_modules-Dir - Remove
package-lock.json - Run
npm i - Restart IDE (especially vscode)
- apply your changes
- merge your branch containing the changes to main
- create new branch from main with bump: version
versionumber old→versionumber new - run
cz bumpto increase version - run
git push origin --tags - merge to main
- start publish pipeline manually
Overview of rules and used plugins/configs.
- eslint-no-console
- eslint-no-alert
- eslint-no-debugger
- eslint-eqeqeq
- eslint-yoda
- eslint-radix
- typescript-eslint-explicit-function-return-type
- typescript-eslint-naming-convention
⚠️ CAUTION: stylelint-no-unsupported-browsers-features is normally only a css linting plugin. It configured to ignore most of the rules that are overlapping with scss - if you think this lib would be better without this plugin let me know