diff --git a/.lintstagedrc.js b/.lintstagedrc.js new file mode 100644 index 000000000..6e18743c2 --- /dev/null +++ b/.lintstagedrc.js @@ -0,0 +1,16 @@ +const escape = require('shell-quote').quote + +/** + * Need this to fix a bug where we can't commit `pages/examples/[example].tsx` + * + * + */ + +module.exports = { + '*.{ts,tsx,js,json,css}': filenames => [ + ...filenames.map(filename => `prettier --check "${escape([filename])}"`), + ...filenames.map(filename => `git add "${filename}"`), + ], + '*.{ts,tsx,js}': ['eslint'], + '*.{ts,tsx,css}': ['stylelint'], +} diff --git a/package.json b/package.json index 13603bccc..cc91581b3 100644 --- a/package.json +++ b/package.json @@ -98,6 +98,7 @@ "rollup-plugin-replace": "^2.2.0", "rollup-plugin-terser": "^7.0.0", "rollup-plugin-typescript2": "^0.27.2", + "shell-quote": "^1.7.2", "simple-git-hooks": ">=2.0.3", "slate": "*", "slate-history": "*", diff --git a/site/pages/examples/[example].tsx b/site/pages/examples/[example].tsx index 3939a4eaf..bb43a9817 100644 --- a/site/pages/examples/[example].tsx +++ b/site/pages/examples/[example].tsx @@ -8,6 +8,7 @@ import ErrorBoundary from 'react-error-boundary' import { Icon } from '../../components' import CheckLists from '../../examples/check-lists' +import CodeHighlighting from '../../examples/code-highlighting' import EditableVoids from '../../examples/editable-voids' import Embeds from '../../examples/embeds' import ForcedLayout from '../../examples/forced-layout' @@ -35,6 +36,7 @@ const EXAMPLES = [ ['Checklists', CheckLists, 'check-lists'], ['Editable Voids', EditableVoids, 'editable-voids'], ['Embeds', Embeds, 'embeds'], + ['Code Highlighting', CodeHighlighting, 'code-highlighting'], ['Forced Layout', ForcedLayout, 'forced-layout'], ['Hovering Toolbar', HoveringToolbar, 'hovering-toolbar'], ['Huge Document', HugeDocument, 'huge-document'], diff --git a/yarn.lock b/yarn.lock index 771e2ca19..7827c34e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10423,7 +10423,7 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shell-quote@1.7.2, shell-quote@^1.6.1: +shell-quote@1.7.2, shell-quote@^1.6.1, shell-quote@^1.7.2: version "1.7.2" resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==