@lifeomic/eslint-plugin-typescript

0.1.1 • Public • Published

eslint-plugin-typescript

LifeOmic config for typescript-eslint

Installation

Next, install @lifeomic/eslint-plugin-typescript:

yarn add -D @lifeomic/eslint-plugin-typescript --save-dev

Usage

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

{
  plugins: ['@lifeomic/typescript'];
}

Add the recommended config and rules to your extends:

{
    extends: ['plugin:@lifeomic/typescript/recommended']
}

There's an optional reactNative config which provides some helpers for reactNative.

NOTE: These make use of the @typescript-eslint/eslint-plugin-tslint plugin, which does not like to be run on non-typescript files, or files not included in a project. That means if you have js files, or ts files outside of a helper included in your lint config, you can do something like this:

const lifeomicTypescript = require('@lifeomic/eslint-plugin-typescript');
const reactNative = lifeomicTypescript.configs.reactNative;

...

  overrides: [
    {
      // src files
      files: ['src/**/*.{ts,tsx}', 'typings/**/*.ts'],
      excludedFiles: [
        'src/**/*.test.{tsx,ts}',
        'src/{testUtils,utils/__mocks__}/**/*'
      ],
      env: {
        node: false,
        browser: true
      },
      rules: {
          ...reactNative.rules // only add these rules to source files
      }
    }
  ]

...

Package Sidebar

Install

npm i @lifeomic/eslint-plugin-typescript

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

6.89 kB

Total Files

6

Last publish

Collaborators

  • lifeomicdev
  • npm-lifeomicdev-github