@priver/eslint-config

8.0.0 • Public • Published

@priver/eslint-config

Shareable config for ESLint. Uses ESLint's new config system.

Installation

pnpm add --save-dev eslint @priver/eslint-config

What's included

Included plugins:

Usage

Config includes of configurations objects that can be combined. Here is some examples for popular platforms/frameworks.

Node app with TypeScript

Add the following in your eslint.config.js:

import path from 'node:path';
import url from 'node:url';

import { base, node, typescript } from '@priver/eslint-config';

const dirname = path.dirname(url.fileURLToPath(import.meta.url));

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
  { ignores: ['scripts/**/*'] }, // files will not be linted
  base,
  node,
  { files: ['**/*.ts'], ...typescript },
  {
    languageOptions: {
      parserOptions: {
        project: path.join(dirname, 'tsconfig.json'),
      },
    },
  },
];

React app with TypeScript and Jest

Add the following in your eslint.config.js:

import path from 'node:path';
import url from 'node:url';

import { base, browser, jest, node, react, typescript } from '@priver/eslint-config';

const dirname = path.dirname(url.fileURLToPath(import.meta.url));

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
  { ignores: ['.next/**/*', 'next-env.d.ts'] }, // files will not be linted
  base,
  browser,
  { files: ['**/*.tsx'], ...react },
  { files: ['**/*.config.js'], ...node },
  { files: ['**/*.ts', '**/*.tsx'], ...typescript },
  { files: ['**/*.test.ts', '**/*.test.tsx'], ...jest },
  {
    languageOptions: {
      parserOptions: {
        project: path.join(dirname, 'tsconfig.json'),
      },
    },
    settings: {
      'jsx-a11y': {
        components: {
          Button: 'button',
          IconButton: 'button',
          Input: 'input',
        },
      },
      'react': { version: '18.2' },
    },
    rules: {
      'n/no-unpublished-import': 'off',
    },
  },
];

Package Sidebar

Install

npm i @priver/eslint-config

Weekly Downloads

0

Version

8.0.0

License

MIT

Unpacked Size

51 kB

Total Files

11

Last publish

Collaborators

  • priver