1
0
Fork 0

chore(eslint): Support Markdown files

This includes JS linting support for the `js` code blocks in our Markdown files. Note that some of those code blocks use C-style syntax to document input and output types (e.g. `Pattern pattern.on(string hook, function method)`), which means those code blocks will start producing lint errors when those Markdown files are touched (those lint errors also happen to be rather obtuse, e.g. `Parsing error: Missing semicolon.`). One solution might be to install [`typescript-eslint`](https://typescript-eslint.io/) and convert the offending code blocks into syntactically valid TypeScript, as long as that doesn't confuse new developers into trying to put TypeScript in their FreeSewing files.
This commit is contained in:
nikhil 2022-09-20 13:49:34 -04:00
parent ecdb466af3
commit 89e5105b12
3 changed files with 25 additions and 5 deletions

View file

@ -2,10 +2,6 @@ env:
browser: true browser: true
es2021: true es2021: true
extends: eslint:recommended extends: eslint:recommended
overrides:
- files: ["*.yaml", "*.yml"]
plugins: ["yaml"]
extends: ["plugin:yaml/recommended"]
# Required when using experimental EcmaScript features # Required when using experimental EcmaScript features
parser: "@babel/eslint-parser" parser: "@babel/eslint-parser"
parserOptions: parserOptions:
@ -17,6 +13,22 @@ parserOptions:
plugins: plugins:
- "@babel/plugin-syntax-import-assertions" - "@babel/plugin-syntax-import-assertions"
rules: {} rules: {}
overrides:
# YAML files
- files: ["**/*.yaml", "**/*.yml"]
plugins: ["yaml"]
extends: ["plugin:yaml/recommended"]
# Markdown files
- files: ["**/*.md"]
plugins: ["markdown"]
processor: "markdown/markdown"
- files: ["**/*.md/*.js"]
rules:
"no-console": "off"
"no-empty": "off"
"no-undef": "off"
"no-unused-labels": "off"
"no-unused-vars": "off"
globals: globals:
it: readonly it: readonly
describe: readonly describe: readonly

View file

@ -75,6 +75,7 @@
"esbuild": "^0.15.3", "esbuild": "^0.15.3",
"esbuild-plugin-yaml": "^0.0.1", "esbuild-plugin-yaml": "^0.0.1",
"eslint": "^8.23.1", "eslint": "^8.23.1",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-yaml": "^0.5.0", "eslint-plugin-yaml": "^0.5.0",
"esm": "^3.2.25", "esm": "^3.2.25",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",

View file

@ -7921,6 +7921,13 @@ eslint-plugin-jsx-a11y@^6.5.1:
minimatch "^3.1.2" minimatch "^3.1.2"
semver "^6.3.0" semver "^6.3.0"
eslint-plugin-markdown@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-markdown/-/eslint-plugin-markdown-3.0.0.tgz#69a63ab3445076a3c2eb6fce6f5114785b19d318"
integrity sha512-hRs5RUJGbeHDLfS7ELanT0e29Ocyssf/7kBM+p7KluY5AwngGkDf8Oyu4658/NZSGTTq05FZeWbkxXtbVyHPwg==
dependencies:
mdast-util-from-markdown "^0.8.5"
eslint-plugin-n@^15.1.0: eslint-plugin-n@^15.1.0:
version "15.2.4" version "15.2.4"
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz#d62021a0821ae650701ed459756aaf478a9b6056" resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz#d62021a0821ae650701ed459756aaf478a9b6056"
@ -12316,7 +12323,7 @@ mdast-util-find-and-replace@^2.0.0:
unist-util-is "^5.0.0" unist-util-is "^5.0.0"
unist-util-visit-parents "^5.0.0" unist-util-visit-parents "^5.0.0"
mdast-util-from-markdown@^0.8.0: mdast-util-from-markdown@^0.8.0, mdast-util-from-markdown@^0.8.5:
version "0.8.5" version "0.8.5"
resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz#d1ef2ca42bc377ecb0463a987910dae89bd9a28c" resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz#d1ef2ca42bc377ecb0463a987910dae89bd9a28c"
integrity sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ== integrity sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==