From 5f3dd6b3c3b7656924586f063494a63a1e1382da Mon Sep 17 00:00:00 2001 From: Kamruzzaman Date: Tue, 3 Feb 2026 23:38:49 +0600 Subject: [PATCH 1/4] chore: add Prettier and ESLint configuration files, update package.json scripts and dependencies --- .prettierignore | 12 ++++++++++++ .prettierrc | 7 +++++++ eslint.config.mjs | 40 ++++++++++++++++++++++++++++++++++++++++ package.json | 14 ++++++++++++-- 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 eslint.config.mjs diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..66b85cd --- /dev/null +++ b/.prettierignore @@ -0,0 +1,12 @@ +# Build output +dist/ +node_modules/ + +# Generated / vendored +*.min.js +*.min.css + +# Lock files +package-lock.json +pnpm-lock.yaml +yarn.lock diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..1a88ab1 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "singleQuote": false, + "tabWidth": 2, + "trailingComma": "es5", + "printWidth": 100 +} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..ef25880 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,40 @@ +import js from "@eslint/js"; +import tseslint from "typescript-eslint"; +import react from "eslint-plugin-react"; +import reactHooks from "eslint-plugin-react-hooks"; +import prettierConfig from "eslint-config-prettier"; + +export default tseslint.config( + js.configs.recommended, + ...tseslint.configs.recommended, + prettierConfig, + { + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + globals: { + React: "readonly", + JSX: "readonly", + }, + }, + plugins: { + react, + "react-hooks": reactHooks, + }, + settings: { + react: { + version: "detect", + }, + }, + rules: { + ...react.configs.recommended.rules, + ...reactHooks.configs.recommended.rules, + "react/react-in-jsx-scope": "off", + "react/prop-types": "off", + }, + } +); diff --git a/package.json b/package.json index 28572e6..41f8aad 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,10 @@ "build:wp": "wp-scripts build --config webpack.config.js", "build:types": "tsc --emitDeclarationOnly", "start": "wp-scripts start --config webpack.config.js", - "lint": "eslint src --ext .ts,.tsx", + "lint": "eslint src", + "lint:fix": "eslint src --fix", + "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"", + "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"", "typecheck": "tsc --noEmit", "prepare": "npm run build" }, @@ -62,15 +65,22 @@ "tw-animate-css": "^1.4.0" }, "devDependencies": { + "@eslint/js": "^9.15.0", "@tailwindcss/postcss": "^4.1.18", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@wordpress/scripts": "^30.25.0", "autoprefixer": "^10.4.23", + "eslint": "^9.15.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-react": "^7.37.0", + "eslint-plugin-react-hooks": "^5.0.0", "postcss": "^8.5.6", "postcss-cli": "^11.0.1", + "prettier": "^3.4.0", "tailwindcss": "^4.1.18", - "typescript": "^5.0.0" + "typescript": "^5.0.0", + "typescript-eslint": "^8.15.0" }, "keywords": [ "wordpress", From 48a1d6872ea8d7fc56777c5dc517a2b4d0528c88 Mon Sep 17 00:00:00 2001 From: Kamruzzaman Date: Tue, 3 Feb 2026 23:43:02 +0600 Subject: [PATCH 2/4] chore: add VSCode settings for ESLint and Prettier integration --- .vscode/settigns.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .vscode/settigns.json diff --git a/.vscode/settigns.json b/.vscode/settigns.json new file mode 100644 index 0000000..9570436 --- /dev/null +++ b/.vscode/settigns.json @@ -0,0 +1,9 @@ +{ + "eslint.enable": true, + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit", + "source.organizeImports": "explicit" + } +} \ No newline at end of file From 1d035555bae2253021dc79b72b2c2e2ebb061793 Mon Sep 17 00:00:00 2001 From: Kamruzzaman Date: Wed, 4 Feb 2026 00:06:52 +0600 Subject: [PATCH 3/4] chore: update Prettier configuration and dependencies, add Tailwind CSS plugin --- .prettierrc | 7 ------- package.json | 9 +++++---- prettier.config.mjs | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 11 deletions(-) delete mode 100644 .prettierrc create mode 100644 prettier.config.mjs diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 1a88ab1..0000000 --- a/.prettierrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "semi": true, - "singleQuote": false, - "tabWidth": 2, - "trailingComma": "es5", - "printWidth": 100 -} diff --git a/package.json b/package.json index 41f8aad..315282c 100644 --- a/package.json +++ b/package.json @@ -70,14 +70,12 @@ "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@wordpress/scripts": "^30.25.0", - "autoprefixer": "^10.4.23", "eslint": "^9.15.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-react": "^7.37.0", "eslint-plugin-react-hooks": "^5.0.0", - "postcss": "^8.5.6", - "postcss-cli": "^11.0.1", - "prettier": "^3.4.0", + "prettier": "^3.8.1", + "prettier-plugin-tailwindcss": "^0.7.2", "tailwindcss": "^4.1.18", "typescript": "^5.0.0", "typescript-eslint": "^8.15.0" @@ -97,5 +95,8 @@ "repository": { "type": "git", "url": "https://github.com/mrabbani/plugin-ui.git" + }, + "overrides": { + "eslint": "$eslint" } } diff --git a/prettier.config.mjs b/prettier.config.mjs new file mode 100644 index 0000000..1cf5d02 --- /dev/null +++ b/prettier.config.mjs @@ -0,0 +1,16 @@ +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */ +export default { + semi: true, + singleQuote: true, + trailingComma: 'es5', + tabWidth: 2, + printWidth: 80, + endOfLine: 'lf', + tailwindStylesheet: path.join(__dirname, 'src/styles.css'), + plugins: ['prettier-plugin-tailwindcss'], +}; From 3e016746c9a619a849fec7eeec9873dfbf1a1a9d Mon Sep 17 00:00:00 2001 From: Kamruzzaman Date: Wed, 4 Feb 2026 15:44:28 +0600 Subject: [PATCH 4/4] Ignore .vscode and remove editor settings --- .gitignore | 3 ++- .vscode/settigns.json | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 .vscode/settigns.json diff --git a/.gitignore b/.gitignore index bb3e03a..53015af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ package-lock.json /node_modules -/dist \ No newline at end of file +/dist +.vscode \ No newline at end of file diff --git a/.vscode/settigns.json b/.vscode/settigns.json deleted file mode 100644 index 9570436..0000000 --- a/.vscode/settigns.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "eslint.enable": true, - "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit", - "source.organizeImports": "explicit" - } -} \ No newline at end of file