From 9acbd4f157a8a0f7f830bbae672090bd0318efa6 Mon Sep 17 00:00:00 2001 From: Cockpit Project Date: Wed, 7 Feb 2024 13:04:33 +0000 Subject: [PATCH 01/12] Makefile: Update Cockpit lib to bc12d5e116b56ebc5509fde7191a2ac5 Closes #784 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cbd7a8d..a8d1ab2 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ COCKPIT_REPO_FILES = \ $(NULL) COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git -COCKPIT_REPO_COMMIT = fca64d4b989ceadabbfda311b971a41490aa2187 # 310 + 2 commits +COCKPIT_REPO_COMMIT = bc12d5e116b56ebc5509fde7191a2ac5c09b1018 # 310.1 + 17 commits $(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP) COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}' From 39014f29e830e665fef9a784eda7ddc0d6948cd4 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Feb 2024 16:35:06 +0100 Subject: [PATCH 02/12] flake8: Add config Use our standard "max line length 118" config from other projects. --- .flake8 | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..cf4c387 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 118 From ad0a653f82d36d5e2a5f56d0df1db4a9e4f1eb7f Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Feb 2024 16:43:38 +0100 Subject: [PATCH 03/12] build.js: Fix escape characters Spotted by ESLint when calling it on build.js itself (which the esbuild integration didn't). --- build.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.js b/build.js index 8fca807..87bdae4 100755 --- a/build.js +++ b/build.js @@ -95,8 +95,8 @@ 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?)$') })], + ...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({ From 5d2840449aaec5c579949ed1f00c1d92e6083caf Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Feb 2024 16:31:04 +0100 Subject: [PATCH 04/12] Use Cockpit's shared static code checks These will soon take over ESLint and stylelint, plus they also cover ruff and other goodies for the Python part. This supersedes the explicit ruff call. This is already being used by cockpit-{podman,machines,navigator} etc. --- Makefile | 4 ++++ test/run | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a8d1ab2..cc3a7ad 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ all: $(DIST_TEST) COCKPIT_REPO_FILES = \ pkg/lib \ test/common \ + test/static-code \ $(NULL) COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git @@ -178,6 +179,9 @@ prepare-check: $(NODE_MODULES_TEST) $(VM_IMAGE) test/common check: prepare-check test/common/run-tests ${RUN_TESTS_OPTIONS} +codecheck: test/static-code $(NODE_MODULES_TEST) + test/static-code + # checkout Cockpit's bots for standard test VM images and API to launch them bots: $(COCKPIT_REPO_STAMP) test/common/make-bots diff --git a/test/run b/test/run index 576d364..1b9cfab 100755 --- a/test/run +++ b/test/run @@ -11,6 +11,5 @@ export RUN_TESTS_OPTIONS=--track-naughties # linters are off by default for production builds, but we want to run them in CI export LINT=1 +make codecheck make check - -ruff check test/check* From bf4889042aa98f288e87cfbf054d90d07d6cc45c Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Wed, 7 Feb 2024 10:40:32 +0100 Subject: [PATCH 05/12] github: allow dependeabot to update github workflow actions Github usually updates their actions once a while and then warns about a node env getting deprecated in runs. Which is not super easily spotted by a developer until it's too late, so let's like npm let dependabot handle updating. --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 198d50c..d17ec69 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -21,3 +21,9 @@ updates: patternfly: patterns: - "@patternfly*" + + - package-ecosystem: "github-actions" + directory: "/" + open-pull-requests-limit: 3 + schedule: + interval: "weekly" From 8256d6f18f17b2fde04f462f53487d6c1e0bbfda Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:00:33 +0000 Subject: [PATCH 06/12] build(deps): bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/cockpit-lib-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cockpit-lib-update.yml b/.github/workflows/cockpit-lib-update.yml index 2f9de38..d3dfa70 100644 --- a/.github/workflows/cockpit-lib-update.yml +++ b/.github/workflows/cockpit-lib-update.yml @@ -22,7 +22,7 @@ jobs: echo '${{ secrets.GITHUB_TOKEN }}' > ~/.config/github-token - name: Clone repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run cockpit-lib-update run: | From 15be8835955f81c212a56cc262cb51a8b2914e0e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Feb 2024 18:51:46 +0100 Subject: [PATCH 07/12] 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 https://github.com/cockpit-project/cockpit/commit/1a28b31828e 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 --- Makefile | 2 +- README.md | 10 ++-------- build.js | 9 --------- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index cc3a7ad..10dd33e 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ COCKPIT_REPO_FILES = \ $(NULL) COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git -COCKPIT_REPO_COMMIT = bc12d5e116b56ebc5509fde7191a2ac5c09b1018 # 310.1 + 17 commits +COCKPIT_REPO_COMMIT = 1a28b31828e309aa2aba6076b1bcc5ee841ac8ea # 310.1 + 30 commits $(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP) COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}' diff --git a/README.md b/README.md index 24730e9..575477d 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ remove manually the symlink: Cockpit Starter Kit uses [ESLint](https://eslint.org/) to automatically check JavaScript code style in `.js` and `.jsx` files. -eslint is executed within every build. +eslint is executed as part of `test/static-code`, aka. `make codecheck`. For developer convenience, the ESLint can be started explicitly by: @@ -94,7 +94,7 @@ Rules configuration can be found in the `.eslintrc.json` file. Cockpit uses [Stylelint](https://stylelint.io/) to automatically check CSS code style in `.css` and `scss` files. -styleint is executed within every build. +styleint is executed as part of `test/static-code`, aka. `make codecheck`. For developer convenience, the Stylelint can be started explicitly by: @@ -106,12 +106,6 @@ Violations of some rules can be fixed automatically by: Rules configuration can be found in the `.stylelintrc.json` file. -During fast iterative development, you can also choose to not run eslint/stylelint. -This speeds up the build and avoids build failures due to e. g. ill-formatted -css or other issues: - - $ ./build.js -es - # Running tests locally Run `make check` to build an RPM, install it into a standard Cockpit test VM diff --git a/build.js b/build.js index 87bdae4..4210743 100755 --- a/build.js +++ b/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({ From cb6a2b84cac6752c4feab11fe22d0472c0c5e5f9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Feb 2024 19:26:55 +0100 Subject: [PATCH 08/12] fmf: Fix saving of artifacts These need to be copied into `$TMT_TEST_DATA`. We already did this in derived projects like cockpit-podman, but forgot it here. --- test/browser/browser.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/browser/browser.sh b/test/browser/browser.sh index e88aa23..1534d93 100755 --- a/test/browser/browser.sh +++ b/test/browser/browser.sh @@ -5,7 +5,7 @@ export TEST_BROWSER=${TEST_BROWSER:-firefox} TESTS="$(realpath $(dirname "$0"))" export SOURCE="$(realpath $TESTS/../..)" -export LOGS="$(pwd)/logs" +export LOGS="${TMT_TEST_DATA:-$(pwd)/logs}" mkdir -p "$LOGS" chmod a+w "$LOGS" From 8bdaa90430227b5379cd86c1afe2ba6d96943071 Mon Sep 17 00:00:00 2001 From: Cockpit Project Date: Thu, 8 Feb 2024 02:12:41 +0000 Subject: [PATCH 09/12] Makefile: Update Cockpit lib to d2a0a971cde5af5353691ee030620be0 Closes #789 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 10dd33e..70263f7 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ COCKPIT_REPO_FILES = \ $(NULL) COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git -COCKPIT_REPO_COMMIT = 1a28b31828e309aa2aba6076b1bcc5ee841ac8ea # 310.1 + 30 commits +COCKPIT_REPO_COMMIT = d2a0a971cde5af5353691ee030620be06c2dbc67 # 310.2 + 1 commits $(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP) COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}' From a0f5432f4e1d639513d5b1a233db1d8a9136944e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Feb 2024 22:24:05 +0100 Subject: [PATCH 10/12] Drop remaining vestiges of `$LINT` This got removed in commit 15be8835955f. --- packaging/cockpit-starter-kit.spec.in | 2 +- test/run | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packaging/cockpit-starter-kit.spec.in b/packaging/cockpit-starter-kit.spec.in index c6b43a3..1235526 100644 --- a/packaging/cockpit-starter-kit.spec.in +++ b/packaging/cockpit-starter-kit.spec.in @@ -32,7 +32,7 @@ rm -rf dist %endif %build -LINT=0 NODE_ENV=production make +NODE_ENV=production make %install %make_install PREFIX=/usr diff --git a/test/run b/test/run index 1b9cfab..5c14f0d 100755 --- a/test/run +++ b/test/run @@ -8,8 +8,5 @@ TEST_SCENARIO="${TEST_SCENARIO:-}" [ "${TEST_SCENARIO}" = "${TEST_SCENARIO##firefox}" ] || export TEST_BROWSER=firefox export RUN_TESTS_OPTIONS=--track-naughties -# linters are off by default for production builds, but we want to run them in CI -export LINT=1 - make codecheck make check From 09c6e956acf77c1e1788b3b043bfe7140defc36f Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Feb 2024 22:28:07 +0100 Subject: [PATCH 11/12] stylelintrc: Drop rules not known in stylelint 16 --- .stylelintrc.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.stylelintrc.json b/.stylelintrc.json index aa78cdb..0133e2c 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,11 +1,7 @@ { "extends": "stylelint-config-standard-scss", "rules": { - "declaration-colon-newline-after": null, - "selector-list-comma-newline-after": null, - "at-rule-empty-line-before": null, - "declaration-colon-space-before": null, "declaration-empty-line-before": null, "custom-property-empty-line-before": null, "comment-empty-line-before": null, @@ -19,9 +15,7 @@ "declaration-block-single-line-max-declarations": null, "font-family-no-duplicate-names": null, "function-url-quotes": null, - "indentation": null, "keyframes-name-pattern": null, - "max-line-length": null, "no-descending-specificity": null, "no-duplicate-selectors": null, "scss/at-extend-no-missing-placeholder": null, From 93ba03c847bd484c6151203f46aac67add30b491 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 20:59:10 +0000 Subject: [PATCH 12/12] build(deps-dev): bump the stylelint group with 4 updates Bumps the stylelint group with 4 updates: [stylelint](https://github.com/stylelint/stylelint), [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard), [stylelint-config-standard-scss](https://github.com/stylelint-scss/stylelint-config-standard-scss) and [stylelint-formatter-pretty](https://github.com/mrcgrtz/stylelint-formatter-pretty). Updates `stylelint` from 15.11.0 to 16.2.1 - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint/compare/15.11.0...16.2.1) Updates `stylelint-config-standard` from 34.0.0 to 36.0.0 - [Release notes](https://github.com/stylelint/stylelint-config-standard/releases) - [Changelog](https://github.com/stylelint/stylelint-config-standard/blob/main/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint-config-standard/compare/34.0.0...36.0.0) Updates `stylelint-config-standard-scss` from 11.1.0 to 13.0.0 - [Release notes](https://github.com/stylelint-scss/stylelint-config-standard-scss/releases) - [Changelog](https://github.com/stylelint-scss/stylelint-config-standard-scss/blob/main/CHANGELOG.md) - [Commits](https://github.com/stylelint-scss/stylelint-config-standard-scss/compare/v11.1.0...v13.0.0) Updates `stylelint-formatter-pretty` from 3.2.1 to 4.0.0 - [Release notes](https://github.com/mrcgrtz/stylelint-formatter-pretty/releases) - [Commits](https://github.com/mrcgrtz/stylelint-formatter-pretty/compare/v3.2.1...v4.0.0) --- updated-dependencies: - dependency-name: stylelint dependency-type: direct:development update-type: version-update:semver-major dependency-group: stylelint - dependency-name: stylelint-config-standard dependency-type: direct:development update-type: version-update:semver-major dependency-group: stylelint - dependency-name: stylelint-config-standard-scss dependency-type: direct:development update-type: version-update:semver-major dependency-group: stylelint - dependency-name: stylelint-formatter-pretty dependency-type: direct:development update-type: version-update:semver-major dependency-group: stylelint ... Signed-off-by: dependabot[bot] --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 85ac1c8..59ef5cf 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,10 @@ "jed": "1.1.1", "qunit": "2.20.0", "sass": "1.70.0", - "stylelint": "15.11.0", - "stylelint-config-standard": "34.0.0", - "stylelint-config-standard-scss": "11.1.0", - "stylelint-formatter-pretty": "3.2.1" + "stylelint": "16.2.1", + "stylelint-config-standard": "36.0.0", + "stylelint-config-standard-scss": "13.0.0", + "stylelint-formatter-pretty": "4.0.0" }, "dependencies": { "@patternfly/patternfly": "5.2.0",