Skip to content

xyhxx/proste-eslint-config

Repository files navigation

support flat config

Usage

// eslint.config.js

import eslintConfig from 'eslint-config-proste';
import process from 'node:process';

export default eslintConfig({
  ts: {
    parseOptions: {
      project: 'tsconfig.json',
      tsconfigRootDir: process.cwd(),
    },
  },
});

Support

  • Typescript
  • React
  • Import
  • Prettier
  • Vue
  • Unicorn
  • JSX-A11y

In most cases, the configuration will automatically start. uselocal-pkg.

You can also turn on or off and rewrite the rules yourself.

export type VueVersion = 2 | 3;
export type ReactVersion = 'detect' | Omit<string, 'detect'>;

export type BaseEnableOption<T extends Record<string, any>> = {
  overrides?: Linter.RulesRecord;
} & T;
export type EnableOption<T extends Record<string, any> = object> =
  | boolean
  | BaseEnableOption<T>;
export type BaseConfigOptions<T extends Record<string, any> = object> = {
  overrides?: Linter.RulesRecord;
} & T;

export type EslintConfigOptions = {
  ignores?: Linter.FlatConfig['ignores'];
  react?: EnableOption<{
    version?: ReactVersion;
    compiler?: boolean;
  }>;
  ts?: EnableOption<{
    parseOptions?: Linter.ParserOptions;
  }>;
  prettier?: EnableOption;
  unicorn?: EnableOption;
  vitestGlobals?: EnableOption;
  jsxA11y?: EnableOption;
  vue?: EnableOption<{
    version?: 2 | 3;
  }>;
  js?: EnableOption;
  import?: EnableOption;
};
type MaybePromise<T> = T | Promise<T>;