@priver/eslint-config

Shareable config for eslint

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@priver/eslint-config
007.0.34 months ago5 years agoMinified + gzip package size for @priver/eslint-config in KB

Readme

@priver/eslint-config
Shareable config for eslint.
NPM version Node version Dependency status NPM License

Installation

npm install --save-dev eslint @rushstack/eslint-patch @priver/eslint-config

What's included

Usage

All configs require that you set up browserslist configuration. Test should have \*.test.\* suffix.

TypeScript: browser apps or libs

Add the following in your .eslintrc.js:
'use strict';

require('@rushstack/eslint-config/patch/modern-module-resolution');

/** @type {import('eslint').Linter.Config} */
module.exports = {
  root: true,
  extends: ['@priver/eslint-config/browser'],
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: ['./tsconfig.eslint.json'],
  },
  settings: {
    'import/resolver': {
      typescript: {
        project: './tsconfig.eslint.json',
      },
    },
    'jest': {
      version: 27,
    },
    'react': {
      version: '17.0',
    },
    'formComponents': [{ name: 'Form', formAttribute: 'endpoint' }],
    'linkComponents': [{ name: 'Link', linkAttribute: 'to' }],
  },
  rules: {
    'react/react-in-jsx-scope': 'error', // for React < 18
  },
};

TypeScript: node apps and libs

Add the following in your .eslintrc.js:
'use strict';

require('@rushstack/eslint-config/patch/modern-module-resolution');

/** @type {import('eslint').Linter.Config} */
module.exports = {
  root: true,
  extends: ['@priver/eslint-config/node-ts'],
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: ['./tsconfig.eslint.json'],
  },
  settings: {
    'import/resolver': {
      typescript: {
        project: './tsconfig.eslint.json',
      },
    },
    'jest': {
      version: 27,
    },
  },
};

JavaScript: node apps, libs and configs in CommonJS

Add the following in your .eslintrc.js:
'use strict';

require('@rushstack/eslint-config/patch/modern-module-resolution');

/** @type {import('eslint').Linter.Config} */
module.exports = {
  root: true,
  extends: ['@priver/eslint-config/node-cjs'],
  settings: {
    jest: {
      version: 27,
    },
  },
};