Skip to content

egdelgadillo/eslint-plugin-require-ts-check

Repository files navigation

eslint-plugin-require-ts-check

Require // @ts-check to be added to your files

This repository uses CI/CD to automatically publish new releases as described on my Setup versioning and NPM publication using Github Actions and changesets gist.

Table of contents

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-require-ts-check:

npm install eslint-plugin-require-ts-check --save-dev

Usage

Add eslint-plugin-require-ts-check to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["require-ts-check"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "require-ts-check/require-ts-check": "error"
  }
}

Supported options

This rule supports a combination of any of the following options:

include

Specify the files that should be tested using this rule. This parameter uses the Glob filename matching pattern.

Defaults to all javascript files: [ "**/*.js" ]

include Usage

"rules": {
    "require-ts-check/require-ts-check": ["error", { "include": ["**/my-files/*.*"] }]
  }

exclude

Specify the files that this rule should ignore. This parameter uses the Glob filename matching pattern.

Defaults to the node_modules folder: [ "node_modules" ]

exclude Usage

"rules": {
    "require-ts-check/require-ts-check": ["error", { "exclude": ["**/ignored-files/*.*"] }]
  }

Contributing

  1. Install VSCode recommended extensions. This is needed for formatting.

    In Mac: Cmd + Shift + P:

    Others: Ctrl + Shift + P:

    Find the "Extensions: Show recommended extensions" option and install them.

    Always remember to format the code when saving if your editor does not do it automatically.

  2. Fork the repo

  3. Create a new branch based off of main

  4. Add your changes

  5. Create a new changelog entry by running npm run changeset and fill in the data

    This will create an .md file with a random name in the .changeset folder. This file should contain the changes that were added as part of your contribution. It will later be automatically added to the main CHANGELOG.md file when a new release is created.

  6. Run tests: npm test

  7. Check the code formatting: npm prettier

  8. Run the linter: npm lint

  9. Push your changes and create a PR in the original repository for your new branch pointing to main.