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

Update eslint 20241125 #111

Merged
merged 17 commits into from
Nov 25, 2024
5 changes: 5 additions & 0 deletions .changeset/lazy-apricots-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kucrut/vite-for-wp": patch
---

Update ESLint config, remove prettier
12 changes: 0 additions & 12 deletions .prettierignore

This file was deleted.

28 changes: 0 additions & 28 deletions .prettierrc.json

This file was deleted.

22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Disable the default formatter, use eslint instead.
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix.
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"json",
"jsonc",
"markdown",
"typescript",
"typescriptreact",
"xml",
"yaml"
]
}
93 changes: 10 additions & 83 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import configs from '@kucrut/eslint-config';
import globals from 'globals';
import eslint_js from '@eslint/js';
import prettier from 'eslint-config-prettier';
import ts from 'typescript-eslint';

export default [
...ts.configs.recommended,
...configs.js,
{
rules: {
'@stylistic/max-len': [ 'error', { code: 120, ignoreComments: true } ],
'@typescript-eslint/no-unused-vars': 'off',
},
},
{
ignores: [ '.pnpm-store/*', 'php/*', 'pnpm-lock.yaml', 'types/*', 'vendor/*' ],
},
eslint_js.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
Expand All @@ -15,85 +22,5 @@ export default [
...globals.node,
},
},
plugins: { prettier },
rules: {
'array-bracket-spacing': [ 'error', 'always' ],
'array-callback-return': 'error',
'arrow-parens': [ 'error', 'as-needed' ],
'arrow-spacing': 'error',
'brace-style': [ 'error', '1tbs' ],
'comma-dangle': [ 'error', 'always-multiline' ],
'comma-spacing': 'error',
'comma-style': [ 'error', 'last' ],
'computed-property-spacing': [ 'error', 'always' ],
'constructor-super': 'error',
'curly': [ 'error', 'all' ],
'dot-notation': 'error',
'eol-last': 'error',
'eqeqeq': 'error',
'func-call-spacing': 'error',
'indent': [ 'error', 'tab', { SwitchCase: 1 } ],
'key-spacing': 'error',
'keyword-spacing': 'error',
'linebreak-style': [ 'error', 'unix' ],
'no-alert': 'error',
'no-bitwise': 'error',
'no-caller': 'error',
'no-cond-assign': [ 'error', 'except-parens' ],
'no-console': 'error',
'no-const-assign': 'error',
'no-debugger': 'error',
'no-dupe-args': 'error',
'no-dupe-class-members': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-else-return': 'error',
'no-eval': 'error',
'no-extra-semi': 'error',
'no-fallthrough': 'error',
'no-irregular-whitespace': 'error',
'no-lonely-if': 'error',
'no-mixed-operators': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-multi-spaces': 'error',
'no-multi-str': 'error',
'no-multiple-empty-lines': [ 'error', { max: 1 } ],
'no-nested-ternary': 'error',
'no-redeclare': 'error',
'no-shadow': 'error',
'no-trailing-spaces': 'error',
'no-undef-init': 'error',
'no-undef': 'error',
'no-unreachable': 'error',
'no-unsafe-negation': 'error',
'no-unused-expressions': 'error',
'no-unused-vars': [ 'error', { ignoreRestSiblings: true } ],
'no-useless-computed-key': 'error',
'no-useless-constructor': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-whitespace-before-property': 'error',
'no-with': 'error',
'object-curly-spacing': [ 'error', 'always' ],
'object-shorthand': 'error',
'one-var-declaration-per-line': [ 'error', 'initializations' ],
'operator-linebreak': 'error',
'padded-blocks': [ 'error', 'never' ],
'prefer-const': [ 'error', { destructuring: 'all' } ],
'quote-props': [ 'error', 'consistent' ],
'quotes': [ 'error', 'single', { allowTemplateLiterals: true, avoidEscape: true } ],
'semi-spacing': 'error',
'semi': [ 'error', 'always' ],
'space-before-blocks': [ 'error', 'always' ],
'space-before-function-paren': [ 'error', { anonymous: 'never', named: 'never', asyncArrow: 'always' } ],
'space-in-parens': [ 'error', 'always' ],
'space-infix-ops': 'error',
'space-unary-ops': [ 'error', { overrides: { '!': true, 'yield': true } } ],
'template-curly-spacing': [ 'error', 'always' ],
'valid-typeof': 'error',
'vars-on-top': 'off',
'wrap-iife': 'error',
},
},
];
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Vite integration for WordPress plugins and themes development.",
"author": "Dzikri Aziz",
"license": "MIT",
"packageManager": "pnpm@9.4.0",
"packageManager": "pnpm@9.14.2",
"type": "module",
"types": "types/index.d.ts",
"homepage": "https://github.com/kucrut/vite-for-wp",
Expand All @@ -21,15 +21,16 @@
],
"devDependencies": {
"@changesets/cli": "^2.27.5",
"@eslint/js": "^9.4.0",
"@eslint/js": "^9.15.0",
"@kucrut/eslint-config": "^0.3.1",
"@types/eslint": "^9.6.1",
"@types/node": "^20.14.2",
"dts-buddy": "^0.4.7",
"eslint": "^9.4.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.4.0",
"prettier": "npm:wp-prettier@^3.0.3",
"eslint": "^9.15.0",
"globals": "^15.12.0",
"rollup-plugin-external-globals": "^0.10.0",
"typescript": "^5.4.5",
"typescript-eslint": "^8.15.0",
"vite": "^5.3.0",
"vite-plugin-external": "^4.0.1"
},
Expand Down Expand Up @@ -69,10 +70,9 @@
"access": "public"
},
"scripts": {
"eslint:check": "eslint .",
"eslint": "eslint .",
"generate:types": "node scripts/generate-types.js",
"lint": "npm run prettier:check && npm run eslint:check",
"prettier:check": "prettier --check .",
"lint": "pnpm run eslint",
"release": "changeset publish"
}
}
Loading
Loading