-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy patheslint.config.cjs
More file actions
58 lines (54 loc) · 1.71 KB
/
eslint.config.cjs
File metadata and controls
58 lines (54 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const tsParser = require('@typescript-eslint/parser');
const tsPlugin = require('@typescript-eslint/eslint-plugin');
const unusedImports = require('eslint-plugin-unused-imports');
const nextPlugin = require('@next/eslint-plugin-next');
/** @type {import('eslint').Linter.Config[]} */
module.exports = [
{
ignores: [
'node_modules/**',
'.next/**',
'dist/**',
'out/**',
'coverage/**',
'**/*.d.ts'
]
},
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: { jsx: true }
}
},
plugins: {
'@typescript-eslint': tsPlugin,
'unused-imports': unusedImports,
'@next/next': nextPlugin
},
rules: {
// Next.js specific rules
'@next/next/no-html-link-for-pages': 'error',
'@next/next/no-img-element': 'warn',
'@next/next/no-unwanted-polyfillio': 'error',
'@next/next/no-page-custom-font': 'error',
'@next/next/no-sync-scripts': 'error',
'@next/next/no-document-import-in-page': 'error',
'@next/next/no-head-import-in-document': 'error',
// Console rules - allow warn and error
'no-console': ['warn', { allow: ['warn', 'error', 'log'] }],
// Turn off base no-unused-vars in favor of TypeScript and unused-imports rules
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
// Unused imports handling
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }
]
}
}
];