From 7a9edbcbbe3bab626565edf2f7da25773b6d56c7 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Fri, 16 Jun 2023 05:24:38 +0800 Subject: [PATCH] build: lint JS in Markdown (#3251) * docs: improve local-electron plugin forge.config.js example * build(deps): upgrade @electron/lint-roller * build: lint JS in Markdown --- package.json | 5 +++-- packages/maker/snap/README.md | 2 +- packages/plugin/auto-unpack-natives/README.md | 8 ++++---- packages/plugin/electronegativity/README.md | 2 +- packages/plugin/fuses/README.md | 6 +++--- packages/plugin/local-electron/README.md | 16 ++++++++++------ packages/plugin/vite/README.md | 18 +++++++++--------- packages/plugin/webpack/README.md | 4 ++-- packages/publisher/bitbucket/README.md | 3 ++- .../electron-release-server/README.md | 2 +- packages/publisher/github/README.md | 2 +- packages/publisher/nucleus/README.md | 2 +- packages/publisher/s3/README.md | 2 +- packages/publisher/snapcraft/README.md | 4 ++-- yarn.lock | 8 ++++---- 15 files changed, 45 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index a3dcb61f20..262ee23eab 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,9 @@ "lerna:publish": "lerna publish --force-publish --conventional-commits --no-changelog --exact", "lint:js": "prettier --check . && eslint .", "lint:markdown": "electron-markdownlint \"**/*.md\"", + "lint:markdown-js": "electron-lint-markdown-standard --root . --ignore-path .markdownlintignore --semi \"**/*.md\"", "lint:markdown-links": "electron-lint-markdown-links --root . --ignore-path .markdownlintignore \"**/*.md\"", - "lint": "npm run lint:js && npm run lint:markdown && npm run lint:markdown-links", + "lint": "npm run lint:js && npm run lint:markdown && npm run lint:markdown-js && npm run lint:markdown-links", "lint:fix": "prettier --write .", "link:prepare": "lerna exec -- node ../../../tools/silent.js yarn link --silent --no-bin-links --link-folder ../../../.links", "link:remove": "lerna exec -- node ../../../tools/silent.js yarn unlink --silent --no-bin-links --link-folder ../../../.links", @@ -84,7 +85,7 @@ }, "devDependencies": { "@electron/fuses": ">=1.0.0", - "@electron/lint-roller": "^1.5.0", + "@electron/lint-roller": "^1.6.0", "@knodes/typedoc-plugin-monorepo-readmes": "0.22.5", "@malept/eslint-config": "^2.0.0", "@types/chai": "^4.2.12", diff --git a/packages/maker/snap/README.md b/packages/maker/snap/README.md index b865cb2a82..4b6c189e25 100644 --- a/packages/maker/snap/README.md +++ b/packages/maker/snap/README.md @@ -8,7 +8,7 @@ You can only build the Snapcraft target on Linux systems with the `snapcraft` pa { name: '@electron-forge/maker-snap', config: { - version: "1.1.0", + version: '1.1.0', features: { audio: true, mpris: 'com.example.mpris', diff --git a/packages/plugin/auto-unpack-natives/README.md b/packages/plugin/auto-unpack-natives/README.md index 9ea8b33cf2..7beb5fb7f9 100644 --- a/packages/plugin/auto-unpack-natives/README.md +++ b/packages/plugin/auto-unpack-natives/README.md @@ -7,9 +7,9 @@ This plugin will automatically add all native Node modules in your node_modules module.exports = { plugins: [ - { - name: '@electron-forge/plugin-auto-unpack-natives' - } + { + name: '@electron-forge/plugin-auto-unpack-natives' + } ] -} +}; ``` diff --git a/packages/plugin/electronegativity/README.md b/packages/plugin/electronegativity/README.md index bf4481f274..b513c7d1a7 100644 --- a/packages/plugin/electronegativity/README.md +++ b/packages/plugin/electronegativity/README.md @@ -14,5 +14,5 @@ module.exports = { } ] ] -} +}; ``` diff --git a/packages/plugin/fuses/README.md b/packages/plugin/fuses/README.md index d9c6af46da..5ea64bb6e2 100644 --- a/packages/plugin/fuses/README.md +++ b/packages/plugin/fuses/README.md @@ -24,10 +24,10 @@ const forgeConfig = { plugins: [ new FusesPlugin({ version: FuseVersion.V1, - [FuseV1Options.RunAsNode]: false, + [FuseV1Options.RunAsNode]: false // ...any other options supported by @electron/fuses - }), - ], + }) + ] }; module.exports = forgeConfig; diff --git a/packages/plugin/local-electron/README.md b/packages/plugin/local-electron/README.md index 136b8a9c66..8a8aa3f820 100644 --- a/packages/plugin/local-electron/README.md +++ b/packages/plugin/local-electron/README.md @@ -7,10 +7,14 @@ _Note: This plugin should only be used by people who are building Electron local ```javascript // forge.config.js -{ - name: '@electron-forge/plugin-local-electron', - config: { - electronPath: '/Users/me/projects/electron/out/Testing', - }, -}, +module.exports = { + plugins: [ + { + name: '@electron-forge/plugin-local-electron', + config: { + electronPath: '/Users/me/projects/electron/out/Testing' + } + } + ] +}; ``` diff --git a/packages/plugin/vite/README.md b/packages/plugin/vite/README.md index cb9f904784..795da474fd 100644 --- a/packages/plugin/vite/README.md +++ b/packages/plugin/vite/README.md @@ -16,21 +16,21 @@ module.exports = { { // `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`. entry: 'src/main.js', - config: 'vite.main.config.mjs', + config: 'vite.main.config.mjs' }, { entry: 'src/preload.js', - config: 'vite.preload.config.mjs', - }, + config: 'vite.preload.config.mjs' + } ], renderer: [ { name: 'main_window', - config: 'vite.renderer.config.mjs', - }, - ], - }, - }, - ], + config: 'vite.renderer.config.mjs' + } + ] + } + } + ] }; ``` diff --git a/packages/plugin/webpack/README.md b/packages/plugin/webpack/README.md index c873a1a84f..e5116a6a1e 100644 --- a/packages/plugin/webpack/README.md +++ b/packages/plugin/webpack/README.md @@ -20,10 +20,10 @@ module.exports = { preload: { js: './src/preload.js' } - }], + }] } } } ] -} +}; ``` diff --git a/packages/publisher/bitbucket/README.md b/packages/publisher/bitbucket/README.md index 16ad43486d..9c74c55b57 100644 --- a/packages/publisher/bitbucket/README.md +++ b/packages/publisher/bitbucket/README.md @@ -21,9 +21,10 @@ module.exports = { username: 'myusername', appPassword: 'mysecretapppassword' } + } } ] -} +}; ``` Alternatively you can (and should) use environment variables for the authentication diff --git a/packages/publisher/electron-release-server/README.md b/packages/publisher/electron-release-server/README.md index 8a93a8bdd6..4df46df78b 100644 --- a/packages/publisher/electron-release-server/README.md +++ b/packages/publisher/electron-release-server/README.md @@ -19,5 +19,5 @@ module.exports = { } } ] -} +}; ``` diff --git a/packages/publisher/github/README.md b/packages/publisher/github/README.md index 847fb6bb79..6177acf47e 100644 --- a/packages/publisher/github/README.md +++ b/packages/publisher/github/README.md @@ -19,5 +19,5 @@ module.exports = { } } ] -} +}; ``` diff --git a/packages/publisher/nucleus/README.md b/packages/publisher/nucleus/README.md index 270efc9404..e891f34221 100644 --- a/packages/publisher/nucleus/README.md +++ b/packages/publisher/nucleus/README.md @@ -21,7 +21,7 @@ module.exports = { } } ] -} +}; ``` We recommend you set the `token`option using an environment variable, don't hard code into in your config. diff --git a/packages/publisher/s3/README.md b/packages/publisher/s3/README.md index 907f7921a4..2354822b7f 100644 --- a/packages/publisher/s3/README.md +++ b/packages/publisher/s3/README.md @@ -20,7 +20,7 @@ module.exports = { } } ] -} +}; ``` If you run publish twice with the same version on the same platform, it is possible for your old artifacts to get overwritten in S3. It is your responsibility to ensure that you don't overwrite your own releases. diff --git a/packages/publisher/snapcraft/README.md b/packages/publisher/snapcraft/README.md index ce182571d6..d2c45979a9 100644 --- a/packages/publisher/snapcraft/README.md +++ b/packages/publisher/snapcraft/README.md @@ -13,9 +13,9 @@ module.exports = { { name: '@electron-forge/publisher-snapcraft', config: { - release: "latest/edge, insider/stable" + release: 'latest/edge, insider/stable' } } ] -} +}; ``` diff --git a/yarn.lock b/yarn.lock index f1baebcf58..11296eebfc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1173,10 +1173,10 @@ global-agent "^3.0.0" global-tunnel-ng "^2.7.1" -"@electron/lint-roller@^1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@electron/lint-roller/-/lint-roller-1.5.0.tgz#9b743979e1b03327e475fa696bb781eb2ea05ef2" - integrity sha512-205UxwJEx8zv5wLwPq4wMA0OYrJ7d1GuqOhPav0Uy2HWe4K+DZbSP50safCvZCSpI6Op3DMo79tp5i8VppuPWA== +"@electron/lint-roller@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@electron/lint-roller/-/lint-roller-1.6.0.tgz#ff92da35379b25bce5cf99310ac541ce6a1500d5" + integrity sha512-R3x25b6OK/PQTONfs24FZaYyArS53e/fFB8IDpHFObVMXjkwU+1ePRwysk2jF23ifiQ1bY27llxzLOD+3UugBQ== dependencies: "@dsanders11/vscode-markdown-languageservice" "^0.3.0" glob "^8.1.0"