Socket
Socket
Sign inDemoInstall

eslint-plugin-excalibur

Package Overview
Dependencies
103
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-plugin-excalibur

A [typescript-eslint](https://typescript-eslint.io/getting-started) plugin for [Excalibur](https://excaliburjs.com/).


Version published
Maintainers
1
Install size
91.3 kB
Created

Readme

Source

eslint-plugin-excalibur

A typescript-eslint plugin for Excalibur.

typescript-eslint is required and it only runs on Typescript files. This is so that the rules can be aware of types in order to support some of these rules. This also means that it will take as much time to lint as it will to compile your Typescript files. If you have ideas for how to improve this, please create an issue or PR.

Usage

First, setup eslint and typescript-eslint if you haven't already:

# eslint 9.0 is not yet supported by typescript-eslint
npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint@8 typescript

Install the plugin:

npm install eslint-plugin-excalibur --save-dev

Create an eslint.config.js file:

// @ts-check
import eslint from '@eslint/js'
import excalibur from 'eslint-plugin-excalibur'
import tseslint from 'typescript-eslint'

export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.recommended,
  excalibur.configs.recommended,
)

Legacy Config

If you are using the .eslintrc.js config format, first read the typescript-eslint docs for setting up with legacy config.

Once you have that setup your .eslintrc.js file should look something like this:

/* eslint-env node */
module.exports = {
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:excalibur/recommended-legacy',
  ],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    project: true,
  },
  plugins: ['@typescript-eslint', 'excalibur'],
  root: true,
}

Rules

(TODO)

For now, a list of rules can be found in the rules folder

Troubleshooting

If you get an error that looks like this

ESLint was configured to run on `<tsconfigRootDir>/something.ts` using `parserOptions.project`: /path/to/tsconfig.json

This is because a file was passed through to eslint that is not part of includes in your tsconfig.json. To fix this, either add the file to your includes in tsconfig.json or adjust the eslint config like so:

export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.recommended
  {
    ...excalibur.configs.recommended,
    // e.g. only include your src files
    files: ['src/**/*.ts']
  }
)

See typescript-eslint documentation for more information.

FAQs

Last updated on 15 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc