1.0.1 • Published 2 years ago
eslint-plugin-cnp v1.0.1
eslint-plugin-cnp
Sharable ESLint Plugin for create-npm-package
Installation
Use npm or a compatibility tool to install.
npm install --save-dev eslint eslint-plugin-cnpRequirements
- Node.js v16.15.0 or newer versions.
- ESLint v8.41.0 or newer versions.
Usage
JSON .eslintrc
{
"plugins": ["cnp"],
"rules": {
"sppt/no-console": "error",
"sppt/declaration-array-type": "warn"
}
}Write your config file such as .eslintrc.yml.
plugins:
- sppt
rules:
sppt/no-console: errorSee also Configuring ESLint.
Configs
cnp/recommended... enables the recommended rules.
Rules
Best Practices
| Rule ID | Description | |
|---|---|---|
| cnp/declaration-array-type | Add explicit type declarations for array variables whose type can not be inferred | ⭐️ |
| cnp/no-console | Disallow console expressions | ✒️ |
| cnp/only-import-export | Allow only import and export statements in index files | ⭐️ |
Semantic Versioning Policy
This plugin follows Semantic Versioning and ESLint's Semantic Versioning Policy.
Changelog
Contributing
Welcome your contribution!
See also ESLint Contribution Guide.
Development Tools
npm testruns tests.npm run updateupdates the package version. And it updatessrc/configs/recommended.ts,lib/index.ts, andREADME.md's rule table. See also npm version CLI command.npm run add-rule <RULE_ID>creates three files to add a new rule.
File Structure:
docs/rules/is the directory to put documentation.src/rules/is the directory to put rule definitions.scripts/is the directory to put development scripts.tests/is the directory to put tests forsrc/..eslintignoreand.eslintrc.jsare the configuration to lint this repository.
Dependencies:
This template uses Jest and GitHub Actions for tests, as same as ESLint itself. If you want to use other tools, customize it.
Development Tools:
npm run add-rule foocommand adds a rule definition.npm updatecommand updates the following stuff by themetaproperty of rules:- the header of
docs/rules/*.md. lib/configs/recommended.tsfile.lib/index.tsfile.- the rule table in
README.mdfile.
- the header of
Below is an example of README.