refactor: lint standard
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
# Dependencies
|
||||
node_modules
|
||||
.pnp
|
||||
.pnp.js
|
||||
|
||||
# Build outputs
|
||||
dist
|
||||
build
|
||||
.next
|
||||
out
|
||||
.turbo
|
||||
.swc
|
||||
.cache
|
||||
.vercel
|
||||
.rollup.cache
|
||||
|
||||
# Generated files
|
||||
*.tsbuildinfo
|
||||
.next-env.d.ts
|
||||
pnpm-lock.yaml
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
|
||||
# Storybook
|
||||
storybook-static
|
||||
.storybook-static
|
||||
|
||||
# Coverage
|
||||
coverage
|
||||
.nyc_output
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# IDE
|
||||
.vscode
|
||||
.idea
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Temporary files
|
||||
.temp
|
||||
.tmp
|
||||
*.tmp
|
||||
|
||||
# Changeset
|
||||
.changeset
|
||||
|
||||
# Content layer
|
||||
.contentlayer
|
||||
.source
|
||||
|
||||
# Public assets (usually don't need formatting)
|
||||
public
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import {dirname} from "node:path";
|
||||
import {fileURLToPath} from "node:url";
|
||||
|
||||
import baseReactConfig from "@heroui/standard/eslint/next.mjs";
|
||||
import {defineConfig} from "eslint/config";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const config = defineConfig([...baseReactConfig]);
|
||||
|
||||
export default config;
|
||||
|
||||
+16
-9
@@ -4,6 +4,7 @@ import {defineConfig} from "eslint/config";
|
||||
const config = defineConfig([
|
||||
{
|
||||
ignores: [
|
||||
// Build outputs
|
||||
"**/.temp",
|
||||
"**/.next",
|
||||
"**/.swc",
|
||||
@@ -11,20 +12,26 @@ const config = defineConfig([
|
||||
"**/.cache",
|
||||
"**/.build",
|
||||
"**/.vercel",
|
||||
"**/.changeset",
|
||||
"**/.DS_Store",
|
||||
"**/dist",
|
||||
"**/build",
|
||||
"**/public/*",
|
||||
"**/node_modules/",
|
||||
"**/coverage",
|
||||
"**/__snapshots__",
|
||||
"**/.contentlayer/",
|
||||
"pnpm-lock.yaml",
|
||||
"**/storybook-static",
|
||||
"!public/manifest.json",
|
||||
".rollup.cache",
|
||||
".rollup.cache/**",
|
||||
// Dependencies
|
||||
"**/node_modules/",
|
||||
"**/public/*",
|
||||
// Generated files
|
||||
"pnpm-lock.yaml",
|
||||
"**/.contentlayer/",
|
||||
"**/.source/**",
|
||||
// Test coverage
|
||||
"**/coverage",
|
||||
"**/__snapshots__",
|
||||
// OS files
|
||||
"**/.DS_Store",
|
||||
"**/.changeset",
|
||||
// Exceptions - files we want to lint
|
||||
"!public/manifest.json",
|
||||
"!.vscode",
|
||||
"!scripts",
|
||||
"!.*.js",
|
||||
|
||||
@@ -90,7 +90,7 @@ const lintStaged = {
|
||||
return [];
|
||||
},
|
||||
|
||||
"**/*.{html,css,scss,json,md}": async (files) => {
|
||||
"**/*.{html,css,scss,json,jsonc,md,mdx}": async (files) => {
|
||||
return [`prettier --ignore-path .prettierignore --write ${files.join(" ")}`];
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import {dirname} from "path";
|
||||
import {fileURLToPath} from "url";
|
||||
|
||||
import {FlatCompat} from "@eslint/eslintrc";
|
||||
import js from "@eslint/js";
|
||||
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
|
||||
import typescriptParser from "@typescript-eslint/parser";
|
||||
import {defineConfig} from "eslint/config";
|
||||
import prettierConfig from "eslint-config-prettier";
|
||||
import importPlugin from "eslint-plugin-import";
|
||||
import onlyWarnPlugin from "eslint-plugin-only-warn";
|
||||
import prettierPlugin from "eslint-plugin-prettier";
|
||||
@@ -15,21 +12,17 @@ import unusedImportsPlugin from "eslint-plugin-unused-imports";
|
||||
import globals from "globals";
|
||||
import tseslint from "typescript-eslint";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
recommendedConfig: js.configs.recommended,
|
||||
});
|
||||
|
||||
export default defineConfig([
|
||||
...compat.extends(
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:prettier/recommended",
|
||||
"prettier",
|
||||
),
|
||||
const config = defineConfig([
|
||||
// ESLint recommended rules
|
||||
js.configs.recommended,
|
||||
// TypeScript ESLint recommended rules
|
||||
...tseslint.configs.recommended,
|
||||
// Prettier config - disables conflicting ESLint rules
|
||||
{
|
||||
rules: {
|
||||
...prettierConfig.rules,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs,jsx,ts,tsx}"],
|
||||
languageOptions: {
|
||||
@@ -40,8 +33,7 @@ export default defineConfig([
|
||||
},
|
||||
parser: typescriptParser,
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest",
|
||||
tsconfigRootDir: __dirname,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
sourceType: "module",
|
||||
},
|
||||
@@ -171,6 +163,7 @@ export default defineConfig([
|
||||
},
|
||||
},
|
||||
},
|
||||
// Disable type checking for config files (.*.js, .*.cjs, .*.mjs)
|
||||
{
|
||||
files: [".*.js", ".*.cjs", ".*.mjs"],
|
||||
...tseslint.configs.disableTypeChecked,
|
||||
@@ -184,8 +177,6 @@ export default defineConfig([
|
||||
"**/.cache/**",
|
||||
"**/.build/**",
|
||||
"**/.vercel/**",
|
||||
"**/.rollup.cache/**",
|
||||
"**/.rollup.cache",
|
||||
"**/.changeset/**",
|
||||
"**/.DS_Store",
|
||||
"**/dist/**",
|
||||
@@ -203,3 +194,5 @@ export default defineConfig([
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
export default config;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import {dirname} from "path";
|
||||
import {fileURLToPath} from "url";
|
||||
|
||||
import {FlatCompat} from "@eslint/eslintrc";
|
||||
import typescriptParser from "@typescript-eslint/parser";
|
||||
import {defineConfig} from "eslint/config";
|
||||
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
|
||||
import nextVitals from "eslint-config-next/core-web-vitals";
|
||||
import nextTs from "eslint-config-next/typescript";
|
||||
import reactPlugin from "eslint-plugin-react";
|
||||
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
||||
import reactRefreshPlugin from "eslint-plugin-react-refresh";
|
||||
@@ -12,21 +9,11 @@ import globals from "globals";
|
||||
|
||||
import baseConfig from "./base.mjs";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
});
|
||||
|
||||
export default defineConfig([
|
||||
const config = defineConfig([
|
||||
// Next.js configs - handle both array and object formats
|
||||
...(Array.isArray(nextVitals) ? nextVitals : [nextVitals]),
|
||||
...(Array.isArray(nextTs) ? nextTs : [nextTs]),
|
||||
...baseConfig,
|
||||
...compat.extends(
|
||||
"next",
|
||||
"next/core-web-vitals",
|
||||
"plugin:react/recommended",
|
||||
"plugin:jsx-a11y/recommended",
|
||||
),
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs,jsx,ts,tsx}"],
|
||||
languageOptions: {
|
||||
@@ -42,7 +29,6 @@ export default defineConfig([
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
"jsx-a11y": jsxA11yPlugin,
|
||||
react: reactPlugin,
|
||||
"react-hooks": reactHooksPlugin,
|
||||
"react-refresh": reactRefreshPlugin,
|
||||
@@ -50,9 +36,6 @@ export default defineConfig([
|
||||
rules: {
|
||||
"@next/next/no-html-link-for-pages": "off",
|
||||
"@next/next/no-img-element": "off",
|
||||
"jsx-a11y/click-events-have-key-events": "warn",
|
||||
"jsx-a11y/interactive-supports-focus": "warn",
|
||||
"jsx-a11y/no-autofocus": "off",
|
||||
"no-console": "off",
|
||||
"react-hooks/exhaustive-deps": "off",
|
||||
"react-refresh/only-export-components": "off",
|
||||
@@ -108,3 +91,5 @@ export default defineConfig([
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
export default config;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {dirname} from "path";
|
||||
import {fileURLToPath} from "url";
|
||||
|
||||
import {FlatCompat} from "@eslint/eslintrc";
|
||||
import typescriptParser from "@typescript-eslint/parser";
|
||||
import {defineConfig} from "eslint/config";
|
||||
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
|
||||
import reactPlugin from "eslint-plugin-react";
|
||||
@@ -12,21 +9,8 @@ import globals from "globals";
|
||||
|
||||
import baseConfig from "./base.mjs";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
});
|
||||
|
||||
export default defineConfig([
|
||||
const config = defineConfig([
|
||||
...baseConfig,
|
||||
...compat.extends(
|
||||
"plugin:react/recommended",
|
||||
"plugin:jsx-a11y/recommended",
|
||||
"plugin:react-hooks/recommended",
|
||||
"plugin:storybook/recommended",
|
||||
),
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs,jsx,ts,tsx}"],
|
||||
languageOptions: {
|
||||
@@ -36,6 +20,7 @@ export default defineConfig([
|
||||
JSX: true,
|
||||
React: true,
|
||||
},
|
||||
parser: typescriptParser,
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
@@ -50,6 +35,13 @@ export default defineConfig([
|
||||
storybook: storybookPlugin,
|
||||
},
|
||||
rules: {
|
||||
// React recommended rules
|
||||
...reactPlugin.configs.recommended.rules,
|
||||
...reactHooksPlugin.configs.recommended.rules,
|
||||
...jsxA11yPlugin.configs.recommended.rules,
|
||||
// Storybook recommended rules
|
||||
...storybookPlugin.configs.recommended.rules,
|
||||
// Custom overrides
|
||||
"jsx-a11y/alt-text": "off",
|
||||
"jsx-a11y/click-events-have-key-events": "warn",
|
||||
"jsx-a11y/interactive-supports-focus": "warn",
|
||||
@@ -110,3 +102,5 @@ export default defineConfig([
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
export default config;
|
||||
|
||||
@@ -8,10 +8,8 @@ export default {
|
||||
arrowParens: "always",
|
||||
bracketSameLine: false,
|
||||
bracketSpacing: false,
|
||||
editorconfig: true,
|
||||
endOfLine: "auto",
|
||||
jsxSingleQuote: false,
|
||||
pluginSearchDirs: false,
|
||||
printWidth: 100,
|
||||
semi: true,
|
||||
singleQuote: false,
|
||||
|
||||
+1
-5
@@ -1,11 +1,7 @@
|
||||
import path from "path";
|
||||
import {fileURLToPath} from "url";
|
||||
|
||||
import preset from "@heroui/standard/prettier/base.mjs";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
/** @type {import("prettier").Config} */
|
||||
const config = {
|
||||
...preset,
|
||||
@@ -20,7 +16,7 @@ const config = {
|
||||
plugins: ["prettier-plugin-tailwindcss"],
|
||||
tailwindAttributes: ["className", "classNames"],
|
||||
tailwindFunctions: ["tv", "clsx", "cn"],
|
||||
tailwindStylesheet: path.resolve(__dirname, "./packages/styles/index.css"),
|
||||
tailwindStylesheet: path.resolve(import.meta.dirname, "./packages/styles/index.css"),
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
Reference in New Issue
Block a user