From db93715928cba3a68d5f1622eef0bc05b635f085 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Mon, 13 Jun 2022 11:43:20 -0700 Subject: [PATCH 1/3] chore: Enable containers --- _11ty/plugins/markdown-plugins.js | 6 +++++ docs/rules/semi.md | 40 +++++++++++++++++++++---------- package-lock.json | 13 ++++++++++ package.json | 1 + src/styles/lib/overrides.less | 11 --------- 5 files changed, 48 insertions(+), 23 deletions(-) diff --git a/_11ty/plugins/markdown-plugins.js b/_11ty/plugins/markdown-plugins.js index ff1dce6717..d35a3c2c8f 100644 --- a/_11ty/plugins/markdown-plugins.js +++ b/_11ty/plugins/markdown-plugins.js @@ -1,6 +1,7 @@ "use strict"; const markdownIt = require("markdown-it"); +const markdownItContainer = require("markdown-it-container"); const highlightJS = require("highlight.js"); const { slug } = require("github-slugger"); @@ -38,5 +39,10 @@ module.exports = function syntaxHighlighting(eleventyConfig) { uniqueSlugStartIndex: 1 }); + // add markdown containers + md = md + .use(require("markdown-it-container"), "correct", {}) + .use(require("markdown-it-container"), "incorrect", {}); + eleventyConfig.setLibrary("md", md); }; diff --git a/docs/rules/semi.md b/docs/rules/semi.md index e9c48d69f8..f1962ef0ce 100644 --- a/docs/rules/semi.md +++ b/docs/rules/semi.md @@ -12,8 +12,6 @@ further_reading: - https://web.archive.org/web/20200420230322/http://inimino.org/~inimino/blog/javascript_semicolons --- - - (fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. Requires or disallows semicolons instead of ASI. @@ -100,6 +98,8 @@ Object option (when `"never"`): Examples of **incorrect** code for this rule with the default `"always"` option: +::: incorrect + ```js /*eslint semi: ["error", "always"]*/ @@ -114,8 +114,12 @@ class Foo { } ``` +::: + Examples of **correct** code for this rule with the default `"always"` option: +::: correct + ```js /*eslint semi: "error"*/ @@ -130,10 +134,14 @@ class Foo { } ``` +::: + ### never Examples of **incorrect** code for this rule with the `"never"` option: +::: incorrect + ```js /*eslint semi: ["error", "never"]*/ @@ -148,8 +156,12 @@ class Foo { } ``` +::: + Examples of **correct** code for this rule with the `"never"` option: +::: correct + ```js /*eslint semi: ["error", "never"]*/ @@ -180,10 +192,14 @@ class Foo { } ``` +::: + #### omitLastInOneLineBlock Examples of additional **correct** code for this rule with the `"always", { "omitLastInOneLineBlock": true }` options: +::: correct + ```js /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */ @@ -200,10 +216,14 @@ class C { } ``` +::: + #### beforeStatementContinuationChars Examples of additional **incorrect** code for this rule with the `"never", { "beforeStatementContinuationChars": "always" }` options: +::: incorrect + ```js /*eslint semi: ["error", "never", { "beforeStatementContinuationChars": "always"}] */ import a from "a" @@ -213,8 +233,12 @@ import a from "a" })() ``` +::: + Examples of additional **incorrect** code for this rule with the `"never", { "beforeStatementContinuationChars": "never" }` options: +::: incorrect + ```js /*eslint semi: ["error", "never", { "beforeStatementContinuationChars": "never"}] */ import a from "a" @@ -224,16 +248,8 @@ import a from "a" })() ``` +::: + ## When Not To Use It If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off. - -## Version - -This rule was introduced in ESLint 0.0.6. - -## Resources - -* [Rule source](https://github.com/eslint/eslint/tree/HEAD/lib/rules/semi.js) -* [Test source](https://github.com/eslint/eslint/tree/HEAD/tests/lib/rules/semi.js) -* [Documentation source](https://github.com/eslint/eslint/tree/HEAD/docs/src/rules/semi.md) diff --git a/package-lock.json b/package-lock.json index f68c7d8581..5774f6318c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,6 +50,7 @@ "luxon": "^1.24.1", "markdown-it": "^12.3.2", "markdown-it-anchor": "^6.0.0", + "markdown-it-container": "^3.0.0", "morgan": "^1.10.0", "node-fetch": "^2.6.7", "node-polyfill-webpack-plugin": "^1.0.3", @@ -7699,6 +7700,12 @@ "markdown-it": "*" } }, + "node_modules/markdown-it-container": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/markdown-it-container/-/markdown-it-container-3.0.0.tgz", + "integrity": "sha512-y6oKTq4BB9OQuY/KLfk/O3ysFhB3IMYoIWhGJEidXt1NQFocFK2sA2t0NYZAMyMShAGL6x5OPIbrmXPIqaN9rw==", + "dev": true + }, "node_modules/markdown-it/node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -17567,6 +17574,12 @@ "dev": true, "requires": {} }, + "markdown-it-container": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/markdown-it-container/-/markdown-it-container-3.0.0.tgz", + "integrity": "sha512-y6oKTq4BB9OQuY/KLfk/O3ysFhB3IMYoIWhGJEidXt1NQFocFK2sA2t0NYZAMyMShAGL6x5OPIbrmXPIqaN9rw==", + "dev": true + }, "maximatch": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz", diff --git a/package.json b/package.json index f72f56edcd..9ec84e33e1 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "luxon": "^1.24.1", "markdown-it": "^12.3.2", "markdown-it-anchor": "^6.0.0", + "markdown-it-container": "^3.0.0", "morgan": "^1.10.0", "node-fetch": "^2.6.7", "node-polyfill-webpack-plugin": "^1.0.3", diff --git a/src/styles/lib/overrides.less b/src/styles/lib/overrides.less index e395eb9b17..8e26d8ea42 100644 --- a/src/styles/lib/overrides.less +++ b/src/styles/lib/overrides.less @@ -49,17 +49,6 @@ body { } p { - &.incorrect + div + div + div > pre, /* vars-on-top */ - &.incorrect + div + div > pre, /* no-continue */ - &.incorrect + div > pre { - background-color: #fff6f6; /* hsl(0,100%,98%) light red */ - } - - &.correct + div + div + div > pre, /* vars-on-top */ - &.correct + div + div > pre, /* no-continue */ - &.correct + div > pre { - background-color: #f6fff6; /* hsl(120,100%,98%) light green */ - } &.icon { position:relative; From 2816734fdc249c6ef356afcfac56e8f080dd6252 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Tue, 14 Jun 2022 10:21:34 -0700 Subject: [PATCH 2/3] Update _11ty/plugins/markdown-plugins.js Co-authored-by: Milos Djermanovic --- _11ty/plugins/markdown-plugins.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_11ty/plugins/markdown-plugins.js b/_11ty/plugins/markdown-plugins.js index d35a3c2c8f..cf9a9d8fb6 100644 --- a/_11ty/plugins/markdown-plugins.js +++ b/_11ty/plugins/markdown-plugins.js @@ -41,8 +41,8 @@ module.exports = function syntaxHighlighting(eleventyConfig) { // add markdown containers md = md - .use(require("markdown-it-container"), "correct", {}) - .use(require("markdown-it-container"), "incorrect", {}); + .use(markdownItContainer, "correct", {}) + .use(markdownItContainer, "incorrect", {}); eleventyConfig.setLibrary("md", md); }; From aae039ad3ca74d538412d133129b53c008bb7095 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Tue, 14 Jun 2022 10:23:47 -0700 Subject: [PATCH 3/3] Fix semi.md --- docs/rules/semi.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/rules/semi.md b/docs/rules/semi.md index f1962ef0ce..ec3d2e2a53 100644 --- a/docs/rules/semi.md +++ b/docs/rules/semi.md @@ -12,6 +12,8 @@ further_reading: - https://web.archive.org/web/20200420230322/http://inimino.org/~inimino/blog/javascript_semicolons --- + + (fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. Requires or disallows semicolons instead of ASI. @@ -253,3 +255,13 @@ import a from "a" ## When Not To Use It If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off. + +## Version + +This rule was introduced in ESLint 0.0.6. + +## Resources + +* [Rule source](https://github.com/eslint/eslint/tree/HEAD/lib/rules/semi.js) +* [Test source](https://github.com/eslint/eslint/tree/HEAD/tests/lib/rules/semi.js) +* [Documentation source](https://github.com/eslint/eslint/tree/HEAD/docs/src/rules/semi.md)