ESLint configuration used by dg-scripts.
npm install @dg-scripts/eslint-config






This package includes the shareable ESLint configuration used by Bod CLI.
``bash`
npm install -D @dg-scripts/eslint-config
Create a file named eslint.config.js
with following contents in the root folder of your project:
`js`
export { default } from '@dg-scripts/eslint-config'
Use defineConfig to customize the configuration:
`js
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
})
`
You can override or add rules by using defineConfig with additional configs (recommended):
`js
import { defineConfig } from '@dg-scripts/eslint-config'
export default defineConfig(
{
typescript: {
tsconfigPath: 'tsconfig.json',
},
},
{
name: 'cypress',
ignores: ['cypress', 'cypress.config.ts'],
},
{
name: 'react',
rules: {
'react-refresh/only-export-components': 'off',
},
},
)
`
`js
import { defineConfig } from '@dg-scripts/eslint-config'
export default defineConfig(
{
name: 'base',
rules: {
'node/prefer-global/process': 'off',
'react-refresh/only-export-components': 'off',
},
},
{
name: 'ui',
files: ['src/components/ui/*.tsx'],
rules: {
'react/no-children-map': 'off',
'react/no-clone-element': 'off',
},
},
)
`
Or by chaining methods (not recommended):
`js
import eslintConfig from '@dg-scripts/eslint-config'
export default eslintConfig
.append({
name: 'cypress',
ignores: ['cypress', 'cypress.config.ts'],
})
.append({
name: 'react',
rules: {
'react-refresh/only-export-components': 'off',
},
})
`
By default, type-aware rules are enabled with tsconfigPath: 'tsconfig.json'.
The configuration will automatically look for tsconfig.json in your project root.tsconfig.json
If your is in a different location, you can customize it:
`js
import { defineConfig } from '@dg-scripts/eslint-config'
export default defineConfig({
typescript: {
tsconfigPath: './path/to/tsconfig.json',
},
})
`
To disable type-aware rules:
`js
import { defineConfig } from '@dg-scripts/eslint-config'
export default defineConfig({
typescript: true, // Enable TypeScript support without type-aware rules
})
`
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.
See ESLint inspector report for more details.


