Skip to content

Commit

Permalink
fix: Fix type checking in config examples (web-infra-dev#2965)
Browse files Browse the repository at this point in the history
* Fix type checking in config examples

* Update rspack.config.js
  • Loading branch information
danielkoller authored and siyou committed May 14, 2023
1 parent d9b133f commit 4f459d3
Show file tree
Hide file tree
Showing 32 changed files with 93 additions and 90 deletions.
7 changes: 3 additions & 4 deletions examples/arco-pro/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ const { default: HtmlPlugin } = require("@rspack/plugin-html");

const prod = process.env.NODE_ENV === "production";

/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
entry: { main: "./src/index.tsx" },
devServer: {
Expand Down Expand Up @@ -70,3 +68,4 @@ module.exports = {
debug: false
}
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/basic/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
entry: {
main: "./src/index.js"
Expand All @@ -14,3 +12,4 @@ module.exports = {
],
}
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/bundle-splitting/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
mode: "development",
entry: {
main: {
Expand Down Expand Up @@ -39,3 +37,4 @@ module.exports = {
}
}
};
module.exports = config;
4 changes: 3 additions & 1 deletion examples/code-splitting/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
mode: "development",
entry: {
main: {
Expand All @@ -12,3 +13,4 @@ module.exports = {
}
}
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/cra-ts/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const CopyPlugin = require("copy-webpack-plugin");
/*
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: "./src/index.tsx"
},
Expand All @@ -29,3 +27,4 @@ module.exports = {
}
}
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/cra/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const CopyPlugin = require("copy-webpack-plugin");
/*
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: "./src/index.jsx"
},
Expand All @@ -29,3 +27,4 @@ module.exports = {
}
}
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/emotion/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: "./src/index.jsx"
},
Expand All @@ -18,3 +16,4 @@ module.exports = {
}
}
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/eslint/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const EslintPlugin = require("eslint-rspack-plugin");
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
mode: "development",
context: __dirname,
entry: {
main: "./src/index.js"
},
plugins: [new EslintPlugin()]
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/eslint/rspack.config.loader.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const EslintPlugin = require("eslint-rspack-plugin");
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
mode: "development",
context: __dirname,
entry: {
Expand All @@ -23,3 +21,4 @@ module.exports = {
]
}
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/library/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = [
/** @type {import('@rspack/cli').Configuration} */
const config = [
"var",
"module",
"assign",
Expand Down Expand Up @@ -33,3 +31,4 @@ module.exports = [
}
}
}));
module.exports = config;
7 changes: 3 additions & 4 deletions examples/loader-compat/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: "./src/index.js"
},
Expand Down Expand Up @@ -118,3 +116,4 @@ module.exports = {
]
}
};
module.exports = config;
4 changes: 3 additions & 1 deletion examples/multi-entry/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
mode: "development",
entry: {
index: "./index.js",
Expand All @@ -14,3 +15,4 @@ module.exports = {
}
}
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/nestjs/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
target: "node",
entry: {
Expand Down Expand Up @@ -46,3 +44,4 @@ module.exports = {
}
]
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/perfsee/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const { PerfseePlugin } = require("@perfsee/webpack");
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
entry: {
main: "./src/index.js"
Expand All @@ -16,3 +14,4 @@ module.exports = {
},
plugins: [new PerfseePlugin({})]
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/plugin-compat/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ const CopyPlugin = require("copy-webpack-plugin");
const HtmlPlugin = require("@rspack/plugin-html").default;
const { StatsWriterPlugin } = require("webpack-stats-plugin");
const GeneratePackageJsonPlugin = require('generate-package-json-webpack-plugin')
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
target: "node",
mode: "development",
stats: { all: true },
Expand Down Expand Up @@ -38,6 +36,7 @@ module.exports = {
new GeneratePackageJsonPlugin(basePackage, {})
]
};
module.exports = config;



Expand Down
7 changes: 3 additions & 4 deletions examples/polyfill/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const path = require("path");
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
entry: {
main: "./src/index.js"
Expand All @@ -25,3 +23,4 @@ module.exports = {
]
}
};
module.exports = config;
4 changes: 3 additions & 1 deletion examples/postcss/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
mode: "development",
entry: "./index.js",
builtins: {
Expand All @@ -8,3 +9,4 @@ module.exports = {
}
}
};
module.exports = config;
4 changes: 3 additions & 1 deletion examples/react-15-classic/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: "./src/index.jsx"
},
Expand All @@ -21,3 +22,4 @@ module.exports = {
}
}
};
module.exports = config;
4 changes: 3 additions & 1 deletion examples/react-15/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: "./src/index.jsx"
},
Expand All @@ -18,3 +19,4 @@ module.exports = {
]
}
};
module.exports = config;
3 changes: 2 additions & 1 deletion examples/react-refresh/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
const config = {
mode: "development",
entry: { main: "./src/index.tsx" },
builtins: {
Expand All @@ -11,3 +11,4 @@ module.exports = {
}
}
};
module.exports = config;
4 changes: 3 additions & 1 deletion examples/react-with-less/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require("path");
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
mode: "development",
entry: {
Expand All @@ -24,3 +25,4 @@ module.exports = {
path: path.resolve(__dirname, "dist")
}
};
module.exports = config;
4 changes: 3 additions & 1 deletion examples/react-with-sass/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
mode: "development",
entry: {
main: ["./src/index.jsx"]
Expand All @@ -19,3 +20,4 @@ module.exports = {
html: [{}]
}
};
module.exports = config;
4 changes: 3 additions & 1 deletion examples/react/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: "./src/index.jsx"
},
Expand All @@ -18,3 +19,4 @@ module.exports = {
]
}
};
module.exports = config;
3 changes: 2 additions & 1 deletion examples/solid/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
entry: {
main: "./src/index.jsx"
Expand Down
7 changes: 3 additions & 4 deletions examples/styled-components/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: "./src/index.tsx"
},
Expand All @@ -13,3 +11,4 @@ module.exports = {
]
}
};
module.exports = config;
5 changes: 3 additions & 2 deletions examples/svelte/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const { default: HtmlPlugin } = require("@rspack/plugin-html");

const mode = process.env.NODE_ENV || "development";
const prod = mode === "production";

module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: ["./src/main.ts"]
},
Expand Down Expand Up @@ -56,3 +56,4 @@ module.exports = {
historyApiFallback: true
}
};
module.exports = config;
7 changes: 3 additions & 4 deletions examples/svgr/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
main: "./index.jsx"
},
Expand All @@ -17,3 +15,4 @@ module.exports = {
html: [{ template: "./index.html" }]
}
};
module.exports = config;
Loading

0 comments on commit 4f459d3

Please sign in to comment.