1.2.1 • Published 10 months ago

@archoleat/eslint-flat-compatibility v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

ESLint Flat Compatibility

NPM Version NPM Downloads ESM Provenance CodeQL Specs Commitlint Editorconfig Prettier ESLint Remark

Table of Contents

Installation

bun i -D @archoleat/eslint-flat-compatibility

Usage

Before

import { fileURLToPath } from 'url';
import path from 'path';

import { defineFlatConfig } from 'eslint-define-config';
import { FlatCompat } from '@eslint/eslintrc';

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

const compat = new FlatCompat({
  baseDirectory: __dirname,
  resolvePluginsRelativeTo: __dirname,
});

export default defineFlatConfig([
  ...compat.extends(
    'airbnb-typescript/base',
    'plugin:import/recommended',
    'plugin:import/typescript',
  ),
// ...

After

import { config, env, extend, plugins } from '@archoleat/eslint-flat-compatibility';
import { defineFlatConfig } from 'eslint-define-config';

export default defineFlatConfig([
  // Mimic extends
  ...extend(
    'airbnb-typescript/base',
    'plugin:import/recommended',
    'plugin:import/typescript',
  ),

  // Mimic env
  ...env({
    es2020: true,
    node: true,
  }),

  // Mimic plugins
  ...plugins('airbnb', 'react'),

  // Translate an entire config
  ...config({
    env: {
      es2020: true,
      node: true,
    },
    extends: ['airbnb/base'],
    plugins: ['airbnb', 'unicorn'],
    rules: {
      semi: 'error',
    },
  }),
]);

Contributing

Please read CONTRIBUTING to start contributing.

License

This project is licensed under the MIT license.

1.2.1

10 months ago

1.2.0

11 months ago

1.1.9

11 months ago

1.1.8

12 months ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago