Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix eslint error #652

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": ["@conform-example/*"]
}
8 changes: 8 additions & 0 deletions .changeset/slow-turkeys-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@conform-to/react': patch
'@conform-to/dom': patch
'@conform-to/yup': patch
'@conform-to/zod': patch
---

refactor: resolves eslint error
56 changes: 56 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Logs
*.log
logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
*.pid
*.pid.lock
*.seed
pids

# Anything built
build/

# tsc
*.tsbuildinfo

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Output of 'npm pack'
*.tgz
/playwright-report/
/playwright/.cache/
/test-results/

# DS Store
.DS_Store

# Project files
README
pnpm-lock.yaml

# Build files
.cache/
.wrangler/
!rollup.config.js
/packages/**/*.js
/packages/**/*.mjs
/guide/functions/

# Others
/examples/
/packages/conform-validitystate/

83 changes: 83 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
ignorePatterns: ['node_modules/', '**.d.ts'],
extends: ['eslint:recommended'],
rules: {
'no-console': 'error',
'no-mixed-spaces-and-tabs': 'off',
},
overrides: [
{
files: ['.eslintrc.cjs'],
env: {
node: true,
},
},
{
files: ['**/*.{ts,tsx}'],
plugins: ['@typescript-eslint', 'import'],
parser: '@typescript-eslint/parser',
env: {
commonjs: true,
es6: true,
},
settings: {
'import/internal-regex': '^~/',
'import/resolver': {
node: {
extensions: ['.ts', '.tsx'],
},
typescript: {
alwaysTryTypes: true,
project: [
'./tsconfig.json',
'./packages/*/tsconfig.json',
'./playground/tsconfig.json',
],
},
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'import/no-unresolved': 'off',
'@typescript-eslint/ban-types': 'off',
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
],
},
{
files: ['./packages/conform-react/**/*.{js,jsx,ts,tsx}'],
plugins: ['react', 'jsx-a11y'],
env: {
browser: true,
es6: true,
},
extends: [
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
],
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {},
},
},
},
],
};
9 changes: 0 additions & 9 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
publish: pnpm publish -r
publish: pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 0 additions & 7 deletions examples/radix-ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,4 @@ module.exports = {
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
};
9 changes: 4 additions & 5 deletions examples/radix-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@
"devDependencies": {
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"autoprefixer": "^10.4.17",
"eslint": "^8.55.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.2",
"postcss": "^8.4.33",
"tailwindcss": "^3.4.1",
"typescript": "^5.2.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/remix/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@remix-run/react';
import stylesUrl from '~/styles.css';

export let links: LinksFunction = () => {
export const links: LinksFunction = () => {
return [{ rel: 'stylesheet', href: stylesUrl }];
};

Expand Down
2 changes: 1 addition & 1 deletion examples/remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"cross-env": "^7.0.3",
"eslint": "^8.35.0",
"eslint": "^8.57.0",
"typescript": "^4.9.5"
},
"engines": {
Expand Down
7 changes: 0 additions & 7 deletions examples/shadcn-ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,4 @@ module.exports = {
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
};
11 changes: 5 additions & 6 deletions examples/shadcn-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "shadcn-ui",
"name": "@conform-example/shadcn-ui",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down Expand Up @@ -40,13 +40,12 @@
"@types/node": "^20.11.20",
"@types/react": "^18.2.56",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.17",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.2",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1",
"tailwindcss-animatecss": "^3.0.5",
Expand Down
3 changes: 0 additions & 3 deletions guide/.eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion guide/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Guide } from '~/layout';
import { getMetadata } from '~/util';
import stylesUrl from '~/styles.css';

export let links: LinksFunction = () => {
export const links: LinksFunction = () => {
return [{ rel: 'stylesheet', href: stylesUrl }];
};

Expand Down
2 changes: 1 addition & 1 deletion guide/app/routes/$.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function loader({ params, context }: LoaderFunctionArgs) {
}

export default function Page() {
let { content } = useLoaderData<typeof loader>();
const { content } = useLoaderData<typeof loader>();

return <Markdown content={content} />;
}
2 changes: 1 addition & 1 deletion guide/app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function loader({ context }: LoaderFunctionArgs) {
}

export default function Index() {
let { content } = useLoaderData<typeof loader>();
const { content } = useLoaderData<typeof loader>();

return <Markdown content={content} />;
}
6 changes: 3 additions & 3 deletions guide/app/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ export function getLanguage(code: string | undefined): Language {
}

function base64DecodeUtf8(base64String: string) {
var binaryString = atob(base64String);
var charCodeArray = Array.from(binaryString).map((char) =>
const binaryString = atob(base64String);
const charCodeArray = Array.from(binaryString).map((char) =>
char.charCodeAt(0),
);
var uintArray = new Uint8Array(charCodeArray);
const uintArray = new Uint8Array(charCodeArray);
return new TextDecoder('utf-8').decode(uintArray);
}

Expand Down
3 changes: 1 addition & 2 deletions guide/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"private": true,
"sideEffects": false,
"name": "conform-guide",
"type": "module",
"scripts": {
"build": "remix build",
Expand All @@ -24,13 +25,11 @@
"@cloudflare/workers-types": "^4.20240419.0",
"@octokit/types": "^12.4.0",
"@remix-run/dev": "^2.5.1",
"@remix-run/eslint-config": "^2.5.1",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18",
"@types/react-syntax-highlighter": "^15.5.11",
"eslint": "^8.35.0",
"tailwindcss": "^3.4.0",
"typescript": "^5.3.3",
"wrangler": "^3.28.2"
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:api": "vitest --watch",
"test:e2e": "playwright test --ui",
"lint": "eslint --ignore-path .gitignore --cache --ext .js,.jsx,.ts,.tsx .",
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx .",
"prepare": "husky install"
},
"devDependencies": {
Expand All @@ -22,8 +22,15 @@
"@conform-to/yup": "workspace:*",
"@conform-to/zod": "workspace:*",
"@playwright/test": "^1.44.1",
"@remix-run/eslint-config": "^1.19.3",
"@types/node": "^20.10.4",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"eslint": "^8.57.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react-hooks": "^4.6.2",
"husky": "^8.0.3",
"lint-staged": "^13.1.2",
"prettier": "^3.2.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/conform-dom/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ function createStateProxy<State>(
): Record<string, State> {
const cache: Record<string, State> = {};
return new Proxy(cache, {
get(_, name: string | Symbol, receiver) {
get(_, name: string | symbol, receiver) {
if (typeof name !== 'string') {
return;
}
Expand Down Expand Up @@ -640,7 +640,7 @@ export function createFormContext<
callback: () => void;
getSubject?: () => SubscriptionSubject | undefined;
}> = [];
let latestOptions = options;
const latestOptions = options;
let meta = createFormMeta(options);
let state = createFormState(meta);

Expand Down
4 changes: 2 additions & 2 deletions packages/conform-react/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ export function createFormContext<
>(
options: FormOptions<Schema, FormError, FormValue>,
): FormContext<Schema, FormError, FormValue> {
let { onSubmit, ...rest } = options;
const context = createBaseFormContext(rest);
let { onSubmit } = options;
const context = createBaseFormContext(options);

return {
...context,
Expand Down
Loading
Loading