JSPM

  • Created
  • Published
  • Downloads 300
  • Score
    100M100P100Q89452F
  • License MIT

ESLint configuration used by dg-scripts.

Package Exports

  • @dg-scripts/eslint-config

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dg-scripts/eslint-config) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@dg-scripts/eslint-config

Author LICENSE

Node Version NPM Version CDN

CI Vitest Coverage Vitest Coverage

This package includes the shareable ESLint configuration used by Bod CLI.

Installation

npm install -D @dg-scripts/eslint-config

Usage

Basic Usage

Create a file named eslint.config.js with following contents in the root folder of your project:

export { default } from '@dg-scripts/eslint-config'

With Custom Options

Use defineConfig to customize the configuration:

import { defineConfig } from '@dg-scripts/eslint-config'

export default defineConfig({
  // Customize TypeScript options
  typescript: {
    tsconfigPath: './path/to/tsconfig.json', // Custom tsconfig path
  },
  // Disable some opinionated rules
  lessOpinionated: true,
  // Other options from @antfu/eslint-config
})

With Additional Rules

You can override or add rules by chaining methods:

import eslintConfig from '@dg-scripts/eslint-config'

export default eslintConfig
  .append({
    ignores: ['cypress', 'cypress.config.ts'],
  })
  .append({
    rules: {
      'react-refresh/only-export-components': 'off',
    },
  })

Or use defineConfig with additional configs:

import { defineConfig } from '@dg-scripts/eslint-config'

export default defineConfig(
  {
    typescript: {
      tsconfigPath: 'tsconfig.json',
    },
  },
  {
    ignores: ['cypress', 'cypress.config.ts'],
  },
  {
    rules: {
      'react-refresh/only-export-components': 'off',
    },
  },
)

Type-Aware Rules

By default, type-aware rules are enabled with tsconfigPath: 'tsconfig.json'.

The configuration will automatically look for tsconfig.json in your project root. If your tsconfig.json is in a different location, you can customize it:

import { defineConfig } from '@dg-scripts/eslint-config'

export default defineConfig({
  typescript: {
    tsconfigPath: './path/to/tsconfig.json',
  },
})

To disable type-aware rules:

import { defineConfig } from '@dg-scripts/eslint-config'

export default defineConfig({
  typescript: true, // Enable TypeScript support without type-aware rules
})

Next.js

When package next and @next/eslint-plugin-next are installed in your project, the Next.js configuration will be enabled automatically. No additional configuration is required.

Contact

Email X GitHub