- Install
verdaccio
globally and run it
npm install -g verdaccio
verdaccio
- Install the dependencies and publish the package to the local registry (
verdaccio
)
npm install
npm publish --registry http://localhost:4873
- Create a new project, navigate to it and add an
.npmrc
file pointing to the local registry
ng new linter-test-project
cd linter-test-project
echo registry=http://localhost:4873 >> .npmrc
- Install the package
# This will install the local version of the plugin because of the .npmrc config
npm install -D eslint-plugin-clarity-migration
- Install the other linter dependencies
npm i -D @typescript-eslint/parser eslint-html-parser eslint
- Add ESLint configuration for TypeScript and HTML.
.eslintrc.json
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module"
},
"plugins": ["clarity-migration"],
"rules": {
"clarity-migration/no-clr-button": "error"
},
"overrides": [
{
"files": ["*.html"],
"parser": "eslint-html-parser"
}
]
}
- Lint the project
# Lint both the TypeScript and HTML files
npx eslint --ext=ts,html src/
- To republish the package without bumping the version, first unpublish it from the repository:
npm unpublish --registry http://localhost:4873 eslint-plugin-clarity-migration --force
Then, publish it anew:
npm publish --registry http://localhost:4873
- Angular application - https://github.com/sis0k0/clarity-linter-demo You need to clone the linter plugin and install it to a local repository (see the steps above).