Skip to content

Commit 3676a59

Browse files
committed
Fix linting with build files
1 parent 2b9f944 commit 3676a59

File tree

4 files changed

+44
-37
lines changed

4 files changed

+44
-37
lines changed
Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,53 @@
1-
import typescriptEslint from '@typescript-eslint/eslint-plugin'
2-
import stylistic from '@stylistic/eslint-plugin'
31
import globals from 'globals'
2+
import pluginJs from '@eslint/js'
3+
import pluginReact from 'eslint-plugin-react'
4+
import pluginTs from 'typescript-eslint'
5+
import pluginVue from 'eslint-plugin-vue'
6+
import stylistic from '@stylistic/eslint-plugin'
47
import tsParser from '@typescript-eslint/parser'
5-
import path from 'node:path'
6-
import { fileURLToPath } from 'node:url'
7-
import js from '@eslint/js'
8-
import { FlatCompat } from '@eslint/eslintrc'
9-
10-
const __filename = fileURLToPath(import.meta.url)
11-
const __dirname = path.dirname(__filename)
12-
const compat = new FlatCompat({
13-
baseDirectory: __dirname,
14-
recommendedConfig: js.configs.recommended,
15-
allConfig: js.configs.all,
16-
})
8+
import typescriptEslint from '@typescript-eslint/eslint-plugin'
179

1810
export default [
19-
...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended'),
2011
{
21-
plugins: {
22-
'@typescript-eslint': typescriptEslint,
23-
'@stylistic': stylistic,
24-
},
12+
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
13+
ignores: ['**/dist/**'],
2514

2615
languageOptions: {
27-
globals: {
28-
...globals.browser,
29-
...globals.node,
16+
globals: globals.browser,
17+
parser: tsParser,
18+
},
19+
20+
settings: {
21+
react: {
22+
version: '18',
3023
},
24+
},
3125

32-
parser: tsParser,
26+
plugins: {
27+
'js': pluginJs,
28+
'react': pluginReact,
29+
'vue': pluginVue,
30+
'@stylistic': stylistic,
31+
'@typescript-eslint': typescriptEslint,
3332
},
3433

3534
rules: {
36-
quotes: ['error', 'single'],
35+
...pluginJs.configs.recommended.rules,
36+
...pluginTs.configs.recommended.reduce((carry, config) => ({ ...carry, ...config.rules }), {}),
37+
...pluginReact.configs.flat.recommended.rules,
38+
...pluginVue.configs['flat/recommended'].reduce((carry, config) => ({ ...carry, ...config.rules }), {}),
39+
'quotes': ['error', 'single'],
3740
'no-trailing-spaces': ['error'],
3841
'object-curly-spacing': ['error', 'always'],
3942
'comma-dangle': ['error', 'always-multiline'],
40-
semi: ['error', 'never'],
43+
'semi': ['error', 'never'],
4144
'@typescript-eslint/no-non-null-assertion': ['off'],
4245
'@typescript-eslint/ban-ts-comment': ['off'],
4346
'@typescript-eslint/no-explicit-any': ['off'],
4447
'@stylistic/no-extra-semi': ['error'],
4548
'@stylistic/arrow-parens': ['error'],
4649
'@stylistic/space-infix-ops': ['error'],
50+
'@stylistic/indent': ['error', 4],
4751
},
4852
},
4953
]

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"private": true,
3+
"type": "module",
34
"workspaces": [
45
"packages/core",
56
"packages/react",
@@ -13,8 +14,7 @@
1314
"build": "npm run build --workspaces",
1415
"link": "npm link --workspaces",
1516
"typeCheck": "npm run typeCheck --workspaces",
16-
"lint": "eslint --ignore-pattern /packages/**/dist/** ./packages/**",
17-
"lint:fix": "eslint --fix --ignore-pattern /packages/**/dist/** ./packages/**",
17+
"lint": "eslint",
1818
"test": "npm run test --workspaces --if-present"
1919
},
2020
"devDependencies": {
@@ -24,6 +24,9 @@
2424
"@typescript-eslint/eslint-plugin": "^8.3.0",
2525
"@typescript-eslint/parser": "^8.3.0",
2626
"eslint": "^9.9.1",
27-
"globals": "^15.9.0"
27+
"eslint-plugin-react": "^7.35.2",
28+
"eslint-plugin-vue": "^9.28.0",
29+
"globals": "^15.9.0",
30+
"typescript-eslint": "^8.4.0"
2831
}
2932
}

packages/core/src/validator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const createValidator = (callback: ValidationCallback, initialData: Recor
3737
return listeners.validatingChanged
3838
}
3939

40-
return []
40+
return []
4141
}
4242

4343
/**
@@ -315,7 +315,7 @@ export const createValidator = (callback: ValidationCallback, initialData: Recor
315315
setTouched([name, ...touched]).forEach((listener) => listener())
316316
}
317317

318-
validator(config ?? {})
318+
validator(config ?? {})
319319
}
320320

321321
/**

packages/core/tests/validator.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ it('revalidates when touched changes', async () => {
436436
expect.assertions(1)
437437

438438
let requests = 0
439-
let resolvers = []
440-
let promises = []
441-
let configs = []
439+
const resolvers = []
440+
const promises = []
441+
const configs = []
442442
axios.request.mockImplementation((c) => {
443443
requests++
444444
configs.push(c)
@@ -471,7 +471,7 @@ it('can validate without needing to specify a field', async () => {
471471

472472
return Promise.resolve(precognitionSuccessResponse())
473473
})
474-
let data = { name: 'Tim', framework: 'Laravel' }
474+
const data = { name: 'Tim', framework: 'Laravel' }
475475
const validator = createValidator((client) => client.post('/foo', data))
476476

477477
validator.touch(['name', 'framework']).validate()
@@ -624,7 +624,7 @@ it('uses the lastest config values', async () => {
624624
})
625625

626626
it('does not cancel submit requests', async () => {
627-
let data = {}
627+
const data = {}
628628
let submitConfig
629629
let validateConfig
630630
axios.request.mockImplementation((config) => {
@@ -650,10 +650,10 @@ it('does not cancel submit requests', async () => {
650650
})
651651

652652
it('does not cancel submit requests with custom abort signal', async () => {
653-
let data = {}
653+
const data = {}
654654
let submitConfig
655655
let validateConfig
656-
let abortController = new AbortController
656+
const abortController = new AbortController
657657
axios.request.mockImplementation((config) => {
658658
if (config.precognitive) {
659659
validateConfig = config

0 commit comments

Comments
 (0)