Skip to content

Commit 7e20914

Browse files
committed
fix(.eslintrc) Refactorize after 8b12ee6
1 parent 8b12ee6 commit 7e20914

6 files changed

Lines changed: 196 additions & 136 deletions

File tree

.eslintrc.cjs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,32 @@
22
// Users should polyfill themselves the following interfaces.
33
const notPolyfilled = [
44
'IntersectionObserver',
5-
'TouchEvent',
6-
'WheelEvent',
5+
'Object',
6+
'performance',
77
]
88

99
module.exports = {
10-
extends: ['@cdoublev/eslint-config/react', '@cdoublev/eslint-config/jest'],
11-
settings: {
12-
polyfills: [
13-
'Object',
14-
...notPolyfilled,
15-
],
16-
},
10+
extends: ['@cdoublev/eslint-config', '@cdoublev/eslint-config/react'],
11+
overrides: [
12+
{
13+
extends: ['@cdoublev/eslint-config/node', '@cdoublev/eslint-config/jest'],
14+
files: ['__tests__/**/*.js'],
15+
globals: {
16+
Element: 'readonly',
17+
Event: 'readonly',
18+
MouseEvent: 'readonly',
19+
TouchEvent: 'readonly',
20+
WheelEvent: 'readonly',
21+
document: 'readonly',
22+
},
23+
},
24+
{
25+
extends: ['@cdoublev/eslint-config/browser'],
26+
files: ['src/**/*.js'],
27+
settings: {
28+
polyfills: notPolyfilled,
29+
},
30+
},
31+
],
32+
parser: '@babel/eslint-parser',
1733
}

__tests__/hooks/useScrollIntoView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const createEvent = (type, { button, pointerType, x = 0, y = 0 } = {}) => {
4848
return new PointerEvent(type, init)
4949
case 'touchmove':
5050
touches.mockReturnValueOnce([{ screenX: x * TOUCH_SENSITIVITY, screenY: y * TOUCH_SENSITIVITY }])
51-
return new TouchEvent(type, init) // eslint-disable-line compat/compat
51+
return new TouchEvent(type, init)
5252
case 'wheel':
5353
init.deltaX = x
5454
init.deltaY = y

__tests__/lib/task.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ describe('raf', () => {
1414
expect(ids).toHaveLength(3)
1515
task.cancel(ids[2])
1616

17-
// eslint-disable-next-line compat/compat
1817
return Promise.resolve().then(() => expect(timestamps).toHaveLength(2))
1918
})
2019
})

0 commit comments

Comments
 (0)