-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.ts
More file actions
46 lines (43 loc) · 1.22 KB
/
eslint.config.ts
File metadata and controls
46 lines (43 loc) · 1.22 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
import antfu from '@antfu/eslint-config'
import { createSimplePlugin } from 'eslint-factory'
export default antfu(
{
type: 'lib',
typescript: true,
test: {
overrides: {
'test/padding-around-after-all-blocks': 'error',
'test/padding-around-after-each-blocks': 'error',
'test/padding-around-before-all-blocks': 'error',
'test/padding-around-before-each-blocks': 'error',
'test/padding-around-describe-blocks': 'error',
'test/padding-around-test-blocks': 'error',
},
},
ignores: [
'docs/rules',
'tests/fixtures',
],
},
createSimplePlugin({
name: 'no-src-import-path',
include: ['*.ts', '**/*.ts'],
create(context) {
return {
ImportDeclaration(node) {
const source = node.source?.value
if (typeof source !== 'string' || !source.startsWith('src/'))
return
const nextPath = `@/${source.slice('src/'.length)}`
context.report({
node,
message: 'Use @/ aliases instead of src/ import paths.',
fix(fixer) {
return fixer.replaceText(node.source, `'${nextPath}'`)
},
})
},
}
},
}),
)