diff --git a/package-lock.json b/package-lock.json index 584332715d711..9d236ac987e5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18259,14 +18259,12 @@ "cwd": "^0.10.0", "dir-glob": "^3.0.1", "eslint": "^8.3.0", - "eslint-plugin-markdown": "^2.2.0", "expect-puppeteer": "^4.4.0", "fast-glob": "^3.2.7", "filenamify": "^4.2.0", "jest": "^27.4.5", "jest-dev-server": "^6.0.2", "jest-environment-node": "^27.4.4", - "markdownlint": "^0.25.1", "markdownlint-cli": "^0.31.1", "merge-deep": "^3.0.3", "mini-css-extract-plugin": "^2.5.1", @@ -33653,59 +33651,6 @@ } } }, - "eslint-plugin-markdown": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-markdown/-/eslint-plugin-markdown-2.2.1.tgz", - "integrity": "sha512-FgWp4iyYvTFxPwfbxofTvXxgzPsDuSKHQy2S+a8Ve6savbujey+lgrFFbXQA0HPygISpRYWYBjooPzhYSF81iA==", - "dev": true, - "requires": { - "mdast-util-from-markdown": "^0.8.5" - }, - "dependencies": { - "mdast-util-from-markdown": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz", - "integrity": "sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==", - "dev": true, - "requires": { - "@types/mdast": "^3.0.0", - "mdast-util-to-string": "^2.0.0", - "micromark": "~2.11.0", - "parse-entities": "^2.0.0", - "unist-util-stringify-position": "^2.0.0" - } - }, - "mdast-util-to-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz", - "integrity": "sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==", - "dev": true - }, - "parse-entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz", - "integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==", - "dev": true, - "requires": { - "character-entities": "^1.0.0", - "character-entities-legacy": "^1.0.0", - "character-reference-invalid": "^1.0.0", - "is-alphanumerical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-hexadecimal": "^1.0.0" - } - }, - "unist-util-stringify-position": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", - "integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", - "dev": true, - "requires": { - "@types/unist": "^2.0.2" - } - } - } - }, "eslint-plugin-playwright": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/eslint-plugin-playwright/-/eslint-plugin-playwright-0.8.0.tgz", @@ -45528,47 +45473,6 @@ "integrity": "sha512-jo1OfR4TaEwd5HOrt5+tAZ9mqT4jmpNAusXtyfNzqVm9uiSYFZlKM1wYL4oU7azZW/PxQW53wM0S6OR1JHNa2g==", "dev": true }, - "micromark": { - "version": "2.11.2", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.2.tgz", - "integrity": "sha512-IXuP76p2uj8uMg4FQc1cRE7lPCLsfAXuEfdjtdO55VRiFO1asrCSQ5g43NmPqFtRwzEnEhafRVzn2jg0UiKArQ==", - "dev": true, - "requires": { - "debug": "^4.0.0", - "parse-entities": "^2.0.0" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "parse-entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz", - "integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==", - "dev": true, - "requires": { - "character-entities": "^1.0.0", - "character-entities-legacy": "^1.0.0", - "character-reference-invalid": "^1.0.0", - "is-alphanumerical": "^1.0.0", - "is-decimal": "^1.0.0", - "is-hexadecimal": "^1.0.0" - } - } - } - }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", diff --git a/package.json b/package.json index e312274da1831..5daf6096d8115 100755 --- a/package.json +++ b/package.json @@ -265,7 +265,6 @@ "lint-lockfile": "node ./bin/validate-package-lock.js", "lint-css": "wp-scripts lint-style \"**/*.scss\"", "lint-css:fix": "npm run lint-css -- --fix", - "lint:md-js": "wp-scripts lint-md-js", "lint:md-docs": "wp-scripts lint-md-docs", "native": "npm run --prefix packages/react-native-editor", "postinstall": "patch-package && node ./patches/patch-xcode.js", diff --git a/packages/create-block-tutorial-template/block-templates/editor.scss.mustache b/packages/create-block-tutorial-template/block-templates/editor.scss.mustache index ae6bb87555cc3..5d0b2deea6c10 100644 --- a/packages/create-block-tutorial-template/block-templates/editor.scss.mustache +++ b/packages/create-block-tutorial-template/block-templates/editor.scss.mustache @@ -4,7 +4,7 @@ * Replace them with your own styles or remove the file completely. */ -.wp-block-{{namespace}}-{{slug}} input[type='text'] { +.wp-block-{{namespace}}-{{slug}} input[type="text"] { font-family: Gilbert, sans-serif; font-size: 64px; color: inherit; diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index dd3c731ae23ac..93cfac7c6a24f 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -4,8 +4,18 @@ ## Breaking Changes +- Remove `lint-md-js` script that was broken for some time and it's extemely hard to make it work correctly with the recommended ESLint config in Markdown files ([#40511](https://github.com/WordPress/gutenberg/pull/40511)). + +### Bug Fixes + - Remove the previously deprecated and undocumented `format-js` command ([#40512](https://github.com/WordPress/gutenberg/pull/40512)). You should use the `format` command instead. +## 22.5.0 (2022-04-21) + +### Bug Fixes + +- Update `markdownlint` and `markdownlint-cli` to the latest versions ([#40479](https://github.com/WordPress/gutenberg/pull/40479)). + ## 22.4.0 (2022-04-08) ### New Feature @@ -17,7 +27,6 @@ - Add `vendor/` to `.markdownlintignore`, to match `lint-md-docs` docs ([#39724](https://github.com/WordPress/gutenberg/pull/39724)). - Include files with `.jsx` extension in the build process ([#39613](https://github.com/WordPress/gutenberg/pull/39613)). - Ensure that the default logic for entry points in the build commands is executed only when used the default config ([#39618](https://github.com/WordPress/gutenberg/pull/39618)). -- Update `markdownlint` and `markdownlint-cli` to the latest versions ([#40479](https://github.com/WordPress/gutenberg/pull/40479)). ## 22.2.0 (2022-03-11) diff --git a/packages/scripts/README.md b/packages/scripts/README.md index 0d4e12ca8a09c..4b22c55557b09 100644 --- a/packages/scripts/README.md +++ b/packages/scripts/README.md @@ -34,7 +34,6 @@ _Example:_ "lint:css": "wp-scripts lint-style", "lint:js": "wp-scripts lint-js", "lint:md:docs": "wp-scripts lint-md-docs", - "lint:md:js": "wp-scripts lint-md-js", "lint:pkg-json": "wp-scripts lint-pkg-json", "packages-update": "wp-scripts packages-update", "plugin-zip": "wp-scripts plugin-zip", @@ -48,8 +47,8 @@ _Example:_ It might also be a good idea to get familiar with the [JavaScript Build Setup tutorial](https://github.com/WordPress/gutenberg/tree/HEAD/docs/how-to-guides/javascript/js-build-setup.md) for setting up a development environment to use ESNext syntax. It gives a very in-depth explanation of how to use the [build](#build) and [start](#start) scripts. ## Automatic block.json detection and the source code directory -When using the `start` or `build` commands, the source code directory ( the default is `./src`) and its subdirectories are scanned for the existence of `block.json` files. If one or more are found, they are treated a entry points and will be output into corresponding folders in the `build` directory. The allows for the creation of multiple blocks that use a single build process. The source directory can be customized using the `--webpack-src-dir` flag. +When using the `start` or `build` commands, the source code directory ( the default is `./src`) and its subdirectories are scanned for the existence of `block.json` files. If one or more are found, they are treated a entry points and will be output into corresponding folders in the `build` directory. This allows for the creation of multiple blocks that use a single build process. The source directory can be customized using the `--webpack-src-dir` flag. ## Updating to New Release @@ -59,7 +58,6 @@ In most cases bumping the `@wordpress/scripts` version in `package.json` and run We commit to keeping the breaking changes minimal so you can upgrade `@wordpress/scripts` as seamless as possible. - ## Available Scripts ### `build` @@ -256,30 +254,6 @@ By default, files located in `build`, `node_modules`, and `vendor` folders are i It uses [markdownlint](https://github.com/DavidAnson/markdownlint) with the [.markdownlint.json](https://github.com/WordPress/gutenberg/blob/HEAD/packages/scripts/config/.markdownlint.json) configuration. This configuration tunes the linting rules to match WordPress standard, you can override with your own config, see [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli/) for command-line parameters. -### `lint-md-js` - -Uses ESLint to lint the source included in markdown files to enforce standards for JS code. - -_Example:_ - -```json -{ - "scripts": { - "lint:md:js": "wp-scripts lint-md-js" - } -} -``` - -This is how you execute the script with presented setup: - -- `npm run lint:md:js` - lints markdown files in the entire project’s directories. - -By default, files located in `build`, `node_modules`, and `vendor` folders are ignored. - -#### Advanced information - -It uses [eslint-plugin-markdown](https://github.com/eslint/eslint-plugin-markdown) with the [.eslintrc-md.js](https://github.com/WordPress/gutenberg/blob/HEAD/packages/scripts/config/.eslintrc-md.js) configuration. This configuration tunes down the linting rules since documentation often includes just snippets of code. It is recommended to use the markdown linting as a check, but not necessarily a blocker since it might report more false errors. - ### `lint-style` Helps enforce coding style guidelines for your style files. @@ -380,7 +354,7 @@ _Example:_ "start:hot": "wp-scripts start --hot", "start:custom": "wp-scripts start entry-one.js entry-two.js --output-path=custom", "start:copy-php": "wp-scripts start --webpack-copy-php", - "start:custom-directory": "wp-scripts start --webpack-src-dir=custom-directory", + "start:custom-directory": "wp-scripts start --webpack-src-dir=custom-directory" } } ``` diff --git a/packages/scripts/config/.eslintrc-md.js b/packages/scripts/config/.eslintrc-md.js deleted file mode 100644 index dae9d2d3486a4..0000000000000 --- a/packages/scripts/config/.eslintrc-md.js +++ /dev/null @@ -1,15 +0,0 @@ -// eslint config for markdown documentation - -// This configuration is used when parsing JS code blocks -// in documentation. It attempts to allow for snippets of -// codes which may define variables unused, or use variables -// that are assumed to be defined. -module.exports = { - root: true, - plugins: [ 'markdown' ], - extends: [ 'plugin:@wordpress/eslint-plugin/recommended' ], - rules: { - 'no-undef': 'off', - 'no-unused-vars': 'off', - }, -}; diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 069564d877fed..be40869308399 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -58,14 +58,12 @@ "cwd": "^0.10.0", "dir-glob": "^3.0.1", "eslint": "^8.3.0", - "eslint-plugin-markdown": "^2.2.0", "expect-puppeteer": "^4.4.0", "fast-glob": "^3.2.7", "filenamify": "^4.2.0", "jest": "^27.4.5", "jest-dev-server": "^6.0.2", "jest-environment-node": "^27.4.4", - "markdownlint": "^0.25.1", "markdownlint-cli": "^0.31.1", "merge-deep": "^3.0.3", "mini-css-extract-plugin": "^2.5.1", diff --git a/packages/scripts/scripts/lint-md-js.js b/packages/scripts/scripts/lint-md-js.js deleted file mode 100644 index b8f50bce4a9de..0000000000000 --- a/packages/scripts/scripts/lint-md-js.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * External dependencies - */ -const { sync: spawn } = require( 'cross-spawn' ); -const { sync: resolveBin } = require( 'resolve-bin' ); - -/** - * Internal dependencies - */ -const { - fromConfigRoot, - getArgsFromCLI, - hasArgInCLI, - hasFileArgInCLI, - hasProjectFile, -} = require( '../utils' ); - -const args = getArgsFromCLI(); - -const defaultFilesArgs = hasFileArgInCLI() ? [] : [ '**/*.md' ]; - -// See: https://eslint.org/docs/user-guide/configuring#using-configuration-files-1. -const hasLintConfig = hasArgInCLI( '-c' ) || hasArgInCLI( '--config' ); - -// When a configuration is not provided by the project, use from the default -// provided with the scripts module. Instruct ESLint to avoid discovering via -// the `--no-eslintrc` flag, as otherwise it will still merge with inherited. -const defaultConfigArgs = ! hasLintConfig - ? [ '--no-eslintrc', '--config', fromConfigRoot( '.eslintrc-md.js' ) ] - : []; - -// See: https://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories. -const hasIgnoredFiles = - hasArgInCLI( '--ignore-path' ) || hasProjectFile( '.eslintignore' ); - -const defaultIgnoreArgs = ! hasIgnoredFiles - ? [ '--ignore-path', fromConfigRoot( '.eslintignore' ) ] - : []; - -const result = spawn( - resolveBin( 'eslint' ), - [ - ...defaultConfigArgs, - ...defaultIgnoreArgs, - ...args, - ...defaultFilesArgs, - ], - { stdio: 'inherit' } -); - -process.exit( result.status );