Move eslint/stylelint to static-code tests
stylelint 16 causes a deadlock/crash in esbuild [1]. There's no movement
on that issue, and we want stylelint 16 to be able to support the
Browser Baseline 2023.
Follow 1a28b31828 and
move the linters into test/static-code. This also starts to lint files
which are outside of esbuild's realm, such as documentation and
examples.
[1] https://github.com/evanw/esbuild/issues/3542
This commit is contained in:
parent
8256d6f18f
commit
15be883595
3 changed files with 3 additions and 18 deletions
9
build.js
9
build.js
|
|
@ -11,19 +11,14 @@ import { cockpitCompressPlugin } from './pkg/lib/esbuild-compress-plugin.js';
|
|||
import { cockpitPoEsbuildPlugin } from './pkg/lib/cockpit-po-plugin.js';
|
||||
import { cockpitRsyncEsbuildPlugin } from './pkg/lib/cockpit-rsync-plugin.js';
|
||||
import { esbuildStylesPlugins } from './pkg/lib/esbuild-common.js';
|
||||
import { eslintPlugin } from './pkg/lib/esbuild-eslint-plugin.js';
|
||||
import { stylelintPlugin } from './pkg/lib/esbuild-stylelint-plugin.js';
|
||||
|
||||
const production = process.env.NODE_ENV === 'production';
|
||||
const useWasm = os.arch() !== 'x64';
|
||||
const esbuild = (await import(useWasm ? 'esbuild-wasm' : 'esbuild')).default;
|
||||
const lintDefault = process.env.LINT ? process.env.LINT === '0' : production;
|
||||
|
||||
const parser = (await import('argparse')).default.ArgumentParser();
|
||||
parser.add_argument('-r', '--rsync', { help: "rsync bundles to ssh target after build", metavar: "HOST" });
|
||||
parser.add_argument('-w', '--watch', { action: 'store_true', help: "Enable watch mode", default: process.env.ESBUILD_WATCH === "true" });
|
||||
parser.add_argument('-e', '--no-eslint', { action: 'store_true', help: "Disable eslint linting", default: lintDefault });
|
||||
parser.add_argument('-s', '--no-stylelint', { action: 'store_true', help: "Disable stylelint linting", default: lintDefault });
|
||||
const args = parser.parse_args();
|
||||
|
||||
if (args.rsync)
|
||||
|
|
@ -55,8 +50,6 @@ function notifyEndPlugin() {
|
|||
};
|
||||
}
|
||||
|
||||
const cwd = process.cwd();
|
||||
|
||||
// similar to fs.watch(), but recursively watches all subdirectories
|
||||
function watch_dirs(dir, on_change) {
|
||||
const callback = (ev, dir, fname) => {
|
||||
|
|
@ -95,8 +88,6 @@ const context = await esbuild.context({
|
|||
target: ['es2020'],
|
||||
plugins: [
|
||||
cleanPlugin(),
|
||||
...args.no_stylelint ? [] : [stylelintPlugin({ filter: new RegExp(cwd + '/src/.*\\.(css?|scss?)$') })],
|
||||
...args.no_eslint ? [] : [eslintPlugin({ filter: new RegExp(cwd + '/src/.*\\.(jsx?|js?)$') })],
|
||||
// Esbuild will only copy assets that are explicitly imported and used
|
||||
// in the code. This is a problem for index.html and manifest.json which are not imported
|
||||
copy({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue