Skip to content

Commit

Permalink
build: replace webpack with Rspack
Browse files Browse the repository at this point in the history
  • Loading branch information
sectsect committed Oct 2, 2024
1 parent 152ad8b commit 3dbfddb
Show file tree
Hide file tree
Showing 26 changed files with 9,684 additions and 24,755 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.prettierrc.json
.stylelintrc.json
postcss.config.js
tsconfig.json
tailwind.config.js
56 changes: 0 additions & 56 deletions .eslintrc.js

This file was deleted.

185 changes: 185 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
"env": {
"es2021": true,
"browser": true,
"node": true,
"jquery": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.json"
},
"extends": [
"airbnb",
"airbnb-typescript",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"plugins": [
"prefer-arrow",
"@typescript-eslint",
"unused-imports",
"eslint-plugin-tsdoc"
],
"globals": {
"window": true,
"lazySizes": true
},
"rules": {
"import/extensions": 0,
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true,
"optionalDependencies": false
}
],
"sort-imports": 0,
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal"],
"alphabetize": {
"order": "asc"
},
"newlines-between": "never"
}
],
"import/prefer-default-export": "off",
"import/no-default-export": "error",
"prefer-arrow/prefer-arrow-functions": [
"warn",
{
"disallowPrototype": true,
"singleReturnOnly": false,
"classPropertiesAllowed": false
}
],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^Window$",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
"no-alert": 0,
"no-console": 0,
"tsdoc/syntax": "warn",
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/interface-name-prefix": 0,
"@typescript-eslint/naming-convention": [
"error",
{
"selector": ["variable", "function", "parameter"],
"format": ["camelCase"],
"leadingUnderscore": "allow"
},
{
"selector": "variable",
"types": ["boolean"],
"format": ["PascalCase"],
"prefix": ["is", "should"]
},
{
"selector": "class",
"format": ["PascalCase"]
},
{
"selector": "interface",
"format": ["PascalCase"]
},
{
"selector": "typeParameter",
"format": ["PascalCase"],
"prefix": ["T", "K"]
},
{
"selector": "enum",
"format": ["PascalCase"]
}
],
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"prettier/prettier": "error"
},
"settings": {
"react": {
"version": "detect"
},
"import/extensions": [".js", ".jsx", ".json", ".ts", ".tsx"]
// "import/resolver": {
// "webpack": {
// "config": "webpack.config.js"
// }
// }
},
"overrides": [
// Configuration for TypeScript files
{
"files": ["**/*.tsx"],
"plugins": ["react", "react-refresh", "jsx-a11y", "tailwindcss"],
"extends": [
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
"plugin:tailwindcss/recommended",
"plugin:@tanstack/eslint-plugin-query/recommended"
],
"rules": {
"react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
"jsx-a11y/anchor-is-valid": "off", // Next.js use his own internal link system
"jsx-a11y/label-has-associated-control": [
2,
{
"assert": "either" // either check for `htmlFor` or `nesting`
}
],
"react/require-default-props": "off", // Allow non-defined react props as undefined
"react/jsx-props-no-spreading": "off", // _app.tsx uses spread operator and also, react-hook-form
// "react-hooks/exhaustive-deps": "off", // Incorrectly report needed dependency with Next.js router
"react/function-component-definition": [
2,
{
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
],
"react/no-danger": "off", // Allow dangerouslySetInnerHTML
"react/react-in-jsx-scope": "off",
"react/jsx-uses-react": "off",
"react-refresh/only-export-components": [
"warn",
{ "allowConstantExport": true }
],
"import/no-default-export": "off",
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal"],
"pathGroups": [
{
"pattern": "react",
"group": "external",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["react"],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"@typescript-eslint/naming-convention": "off",
"tailwindcss/no-custom-classname": "off"
}
}
]
}
6 changes: 2 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
# Disable concurent to run build-types after ESLint in lint-staged
pnpx lint-staged --concurrent false
6 changes: 6 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"src/**/*.{js,jsx,ts,tsx}": ["pnpm run lint:fix", "pnpm run lint"],
"src/**/*.ts?(x)": "tsc-files --noEmit",
"src/**/*{,.*}.{css,scss}": ["pnpm run lint:css"],
"*": ["secretlint"]
}
12 changes: 0 additions & 12 deletions .modernizrrc

This file was deleted.

8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"css.validate": false,
"scss.validate": false,
// Add support for nested project structure.
"eslint.nodePath": "nextjs/node_modules",
"eslint.workingDirectories": [
"src",
],
// "eslint.nodePath": "nextjs/node_modules",
// "eslint.workingDirectories": [
// "src",
// ],
"vitest.enable": true,
"phpsab.executablePathCS": "./vendor/squizlabs/php_codesniffer/bin/phpcs",
"phpsab.executablePathCBF": "./vendor/squizlabs/php_codesniffer/bin/phpcbf",
Expand Down
2 changes: 1 addition & 1 deletion assets/css/admin-options.css

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions assets/css/admin-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
(() => { // webpackBootstrap
"use strict";
var __webpack_modules__ = ({});
/************************************************************************/
// The module cache
var __webpack_module_cache__ = {};

// The require function
function __webpack_require__(moduleId) {

// Check if module is in cache
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
// Create a new module (and put it into the cache)
var module = (__webpack_module_cache__[moduleId] = {
exports: {}
});
// Execute the module function
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);

// Return the exports of the module
return module.exports;

}

/************************************************************************/
// webpack/runtime/rspack_version
(() => {
__webpack_require__.rv = function () {
return "1.0.8";
};

})();
// webpack/runtime/rspack_unique_id
(() => {
__webpack_require__.ruid = "bundler=rspack@1.0.8";

})();
/************************************************************************/
// extracted by css-extract-rspack-plugin

})()
;
60 changes: 59 additions & 1 deletion assets/js/admin-options.js

Large diffs are not rendered by default.

31 changes: 0 additions & 31 deletions babel.config.js

This file was deleted.

Loading

0 comments on commit 3dbfddb

Please sign in to comment.