eslint-plugin-sppt

ESLint plugin for TypeScript React components

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
eslint-plugin-sppt
011.0.310 months agoa year agoMinified + gzip package size for eslint-plugin-sppt in KB

Readme

eslint-plugin-sppt
npm version Downloads/month Release Testing Linting Build codecov

ESLing Plugin SPPT

Installation

Use npm or a compatibility tool to install.
npm install --save-dev eslint eslint-plugin-sppt

Requirements

  • Node.js v16.15.0 or newer versions.
  • ESLint v8.41.0 or newer versions.

Usage

JSON .eslintrc
{
  "plugins": ["sppt"],
  "rules": {
    "sppt/no-console": "error",
    "sppt/declaration-array-type": "warn"
  }
}

Write your config file such as .eslintrc.yml.
plugins:
  - sppt
rules:
  sppt/no-console: error

See also Configuring ESLint.

Configs

  • sppt/recommended ... enables the recommended rules.

Rules

Best Practices

| Rule ID | Description | | | :-------------------------------------------------------------------- | :-------------------------------------------------------------------------------- | :---: | | sppt/declaration-array-type | Add explicit type declarations for array variables whose type can not be inferred | ⭐️ | | sppt/no-console | Disallow console expressions | ⭐️✒️ | | sppt/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 test runs tests.
  • npm run update updates the package version. And it updates src/configs/recommended.ts, lib/index.ts, and README.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 for src/.
  • .eslintignore and .eslintrc.js are 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 foo command adds a rule definition.
  • npm update command updates the following stuff by the meta property of rules:
- the header of docs/rules/*.md. - lib/configs/recommended.ts file. - lib/index.ts file. - the rule table in README.md file.
Below is an example of README.