eslint-plugin-super-brothers

1.0.0-rc.1 • Public • Published

@super-brothers/eslint-plugin

Eslint in-house plugin to unify projects

Installation

Install eslint and dependencies @super-brothers/eslint-plugin:

npm i eslint --save-dev
npm install @super-brothers/eslint-plugin --save-dev
# in case Vuejs 3 is used as UI framework
npm install @vue/eslint-config-typescript --save-dev

Usage

Add @super-brothers/eslint-plugin to the plugins section of your .eslintrc configuration file. There're several configs for different use

module.exports = {
    extends: [
      'plugin:@super-brothers/eslint-plugin/base', // using mostly for js files
      'plugin:@super-brothers/eslint-plugin/ts-recommended', // using for ts files
      'plugin:@super-brothers/eslint-plugin/jest-recommended', // using for ts test files (*.spec.ts, *.test.ts)
      'plugin:@super-brothers/eslint-plugin/vue3-ui-recommended', // using for ui & component vue3 files
      'plugin:@super-brothers/eslint-plugin/vue3-ts-recommended' // using for vue3 files with ts
    ]
}

Overriding rules

const { commonRules } = require('@super-brothers/eslint-plugin')

module.exports = {
  overrides: [
    // overrding tests config & adding additional rules
    {
      extends: ['plugin:@super-brothers/eslint-plugin/jest-recommended'],
      files: ['tests/**/*.ts'],
      rules: {
        '@typescript-eslint/no-misused-promises': 'off'
      },
      parserOptions: {
        project: ['./tsconfig-tests.json']
      }
    },
    // overrding vue files with ts config & adding additional rules
    {
      extends: ['plugin:@super-brothers/eslint-plugin/vue3-ts-recommended'],
      files: ['ui/**/*.ts'],
      rules: {
        '@typescript-eslint/no-unsafe-argument': 'off'
      },
      parserOptions: {
        project: ['./tsconfig.json']
      }
    },
    // overrding js files with common ruleset
    {
      extends: ['plugin:@super-brothers/eslint-plugin/ts-recommended'],
      files: ['panelOS/**/*.*'],
      rules: {
        ...commonRules.js,
      }
    }
  ]
  
}

Rules adding

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

module.exports = {
    rules: {
        '@super-brothers/eslint-plugin/no-underscore': 'error'
    }
}

Package Sidebar

Install

npm i eslint-plugin-super-brothers

Weekly Downloads

2

Version

1.0.0-rc.1

License

none

Unpacked Size

31.7 kB

Total Files

13

Last publish

Collaborators

  • urbandevelopers