Skip to content

Commit

Permalink
Fix eslint configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
vjee committed Feb 11, 2024
1 parent 539e3a4 commit bc1a5ee
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"eslint.workingDirectories": [
{"directory": "./packages/core", "changeProcessCWD": true},
{"directory": "./packages/react", "changeProcessCWD": true}
]
}
8 changes: 8 additions & 0 deletions DEPLOY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Deploy

- pnpm changeset version
- pnpm install
- git add .
- git commit -m "Bump versions"
- pnpm run build
- pnpm changeset publish
4 changes: 3 additions & 1 deletion config/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ module.exports = {
ecmaVersion: 2019,
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
plugins: ['@typescript-eslint', 'require-extensions'],

extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:require-extensions/recommended',
'prettier',
],
rules: {
Expand Down
5 changes: 4 additions & 1 deletion config/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"main": "index.js",
"files": [
"index.js"
]
],
"devDependencies": {
"eslint-plugin-require-extensions": "^0.1.3"
}
}
2 changes: 1 addition & 1 deletion packages/core/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
root: true,
extends: ['@formulier/eslint-config'],
parserOptions: {
project: true,
project: './tsconfig.lint.json',
tsConfigRootDir: __dirname,
},
}
2 changes: 1 addition & 1 deletion packages/core/tests/array-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect, it} from 'vitest'

import {insert, move, push, remove, swap} from '../src/array-utils'
import {insert, move, push, remove, swap} from '../src/array-utils.js'

const [A, B, C, D] = ['a', 'b', 'c', 'd']

Expand Down
4 changes: 2 additions & 2 deletions packages/core/tests/form.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {expect, it, vi} from 'vitest'

import {Formulier} from '../src/form'
import {getPath} from '../src/state-utils'
import {Formulier} from '../src/form.js'
import {getPath} from '../src/state-utils.js'

const INITIAL_VALUES = {a: {b: {c: 'c', d: 'd'}}}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/tests/state-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {describe, expect, it} from 'vitest'

import {getPath, isInteger, isObject, removeKey, setKey, setPath, toPath} from '../src/state-utils'
import {getPath, isInteger, isObject, removeKey, setKey, setPath, toPath} from '../src/state-utils.js'

const SOURCE = {
a: {b: {c: 'c'}},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "@formulier/tsconfig/base",
"include": ["src/index.ts"],
"files": ["src/index.ts"],
"compilerOptions": {
"outDir": "dist",
"types": ["vitest/importMeta"]
Expand Down
4 changes: 4 additions & 0 deletions packages/core/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*", "tests/**/*"]
}
2 changes: 1 addition & 1 deletion packages/react/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
root: true,
extends: ['@formulier/eslint-config'],
parserOptions: {
project: true,
project: './tsconfig.lint.json',
tsConfigRootDir: __dirname,
},
}
2 changes: 1 addition & 1 deletion packages/react/cypress/component/form-tests.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'

import {FormProvider, useCreateForm, useFormField, useFormInstance} from '../../src'
import {FormProvider, useCreateForm, useFormField, useFormInstance} from '../../src/index.js'

function Form({children}: {children: React.ReactNode}) {
const form = useCreateForm({
Expand Down
2 changes: 1 addition & 1 deletion packages/react/cypress/support/component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import {mount} from 'cypress/react18'

import './commands'
import './commands.js'

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
Expand Down
4 changes: 2 additions & 2 deletions packages/react/tests/use-create-form.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {expect, it} from 'vitest'
import {renderHook} from '@testing-library/react'

import {useCreateForm} from '../src/form'
import {useFormField} from '../src/field'
import {useCreateForm} from '../src/form.js'
import {useFormField} from '../src/field.js'

interface FormState {
a: {b: {c: string; d: string}}
Expand Down
6 changes: 3 additions & 3 deletions packages/react/tests/use-form-field.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {expect, it} from 'vitest'
import {renderHook} from '@testing-library/react'

import {useCreateForm} from '../src/form'
import {useFormField} from '../src/field'
import {useCreateForm} from '../src/form.js'
import {useFormField} from '../src/field.js'

import type {FieldOptions} from '../src/types'
import type {FieldOptions} from '../src/types.js'

interface FormState {
a: {b: {c: string; d: string}}
Expand Down
4 changes: 2 additions & 2 deletions packages/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": ["src/index.ts"],
"compilerOptions": {
"outDir": "dist",
"jsx": "react-jsx",
"types": ["vitest/importMeta"]
"types": ["vitest/importMeta"],
"jsx": "react-jsx"
}
}
4 changes: 4 additions & 0 deletions packages/react/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*", "tests/**/*", "cypress/**/*"]
}
15 changes: 14 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bc1a5ee

Please sign in to comment.