Update spellcheck config and scripts (#8012)

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
This commit is contained in:
fisker CheungandGeorgii Dolzhykov authored and GitHub committed 2020-04-12 01:19:00 +08:00
1 parent 5569e3306e
commit f475a5bd43
8 files changed
+106 -97

No files matched your search

+47 -91
View File
@@ -8,7 +8,6 @@
"animationend",
"ansible",
"apos",
"aquibm",
"arduner",
"arrayify",
"Artem",
@@ -24,15 +23,14 @@
"autogenerated",
"autolink",
"autolinks",
"autoload",
"autoloaded",
"autoloading",
"Azzola",
"backport",
"backticks",
"bakkot",
"behaviour",
"Bekkelund",
"belochub",
"benjie",
"Bento",
"bigint",
"binaryish",
@@ -41,8 +39,7 @@
"blenda",
"blockquote's",
"bookmarklet",
"bopomofo",
"brainkim",
"Bopomofo",
"Breakell",
"Brevik",
"bugfix",
@@ -55,7 +52,6 @@
"chrzosel",
"Clemmons",
"cliify",
"cloudflare",
"cmds",
"codebases",
"codeblock",
@@ -70,15 +66,15 @@
"cond",
"cosmiconfig",
"CRLFs",
"crossorigin",
"daleroy",
"danez",
"dangmai",
"Dara",
"dashify",
"dcyriller",
"declarators",
"dedent",
"defun",
"deltice",
"deopt",
"deps",
"destructured",
@@ -86,10 +82,13 @@
"devs",
"docblock",
"docblocks",
"doctag",
"Docusaurus's",
"Dodds",
"Dolzhykov",
"dotfile",
"dotfiles",
"downlevel",
"duailibe",
"Duperron",
"editorconfig",
@@ -97,59 +96,51 @@
"elektronik",
"Eneman",
"ENOENT",
"ericsakmar",
"Ericsburgh",
"errored",
"Esben",
"esbenp",
"eslint's",
"eslump",
"esproposal",
"estree",
"esutils",
"eval",
"evilebottnawi",
"execa",
"fbglyph",
"FBID",
"Ficarra",
"filepath",
"Filipe",
"finalizer",
"Fiorini",
"flxwu",
"fnames",
"formatprg",
"Friedly",
"frobble",
"fuzzer",
"gavinjoyce",
"Georgii",
"gettin",
"git's",
"gitattributes",
"githook",
"gitignore",
"gitkeep",
"Gitter",
"gitter",
"glimmerjs",
"globbing",
"globby",
"gofmt",
"googlegroups",
"googlemaps",
"Gregor",
"hackily",
"haggholm",
"gtag",
"Hampus",
"hardcoded",
"hardline",
"hardlines",
"harel",
"hashbang",
"Hawken",
"Hengles",
"Hersevoort",
"hljs",
"hlsson",
"hongrich",
"Horky",
"hotpink",
"hsla",
@@ -160,15 +151,14 @@
"iarna",
"ICSS",
"idempotence",
"IIFE",
"iife",
"IIFEs",
"ikatyang",
"Ilya",
"impltype",
"importee",
"importmap",
"indentable",
"indexof",
"Indentable",
"infc",
"instanceof",
"Intelli",
@@ -176,55 +166,40 @@
"jackyho",
"Jakefile",
"jakegavin",
"jbrown",
"jetbrains",
"jlongster",
"jnwng",
"Joar",
"josephfrazier",
"Joun",
"jounqin",
"jridgewell",
"jscodefmt",
"jsesc",
"jsfmt",
"JSXs",
"junit",
"jwbay",
"kachkaev",
"kalmanb",
"Karimov",
"Kassens",
"Kasturi",
"Kearney",
"keyof",
"Khatri",
"koba",
"lcov",
"libdef",
"linearize",
"linebreak",
"linebreaks",
"literalline",
"literallines",
"lockfile",
"Literallines",
"loglevel",
"lowercased",
"lowercasing",
"lydell",
"macos",
"malcolmsgroves",
"Marek",
"Masad",
"Matejka",
"Mateusz",
"mattiaerre",
"matzkoh",
"MDAST",
"memberish",
"mdast",
"Memberish",
"memoized",
"Michał",
"microsyntax",
"Microsyntax",
"Mikael",
"minimise",
"miniprettier",
@@ -238,23 +213,24 @@
"mousedown",
"mouseup",
"mprettier",
"msapplication",
"multiparser",
"Muntean",
"nargs",
"navbutton",
"neoclide",
"neoformat",
"neovim",
"netrc",
"nicolo",
"nnoremap",
"nodir",
"noncharacters",
"nonenumerable",
"nonspacing",
"Nonspacing",
"noopener",
"noreferrer",
"normalise",
"normalised",
"nrvtbfux",
"nullability",
"nullish",
"Nuno",
@@ -262,8 +238,6 @@
"octicon",
"Okazaki",
"Okonetchnikov",
"oneth",
"onurtemizkan",
"onwarn",
"Oopsy",
"overparenthesization",
@@ -271,7 +245,6 @@
"packagejson",
"Panasenko",
"Pangsakulyanont",
"papayawhip",
"paren",
"parens",
"parentless",
@@ -279,25 +252,23 @@
"pcss",
"Pierzchała",
"Pieter",
"pomber",
"postprocess",
"postprocessor",
"precache",
"precommit",
"prefetch",
"preorder",
"Prettier's",
"prettier's",
"Prettier’s",
"prettierformatsource",
"prettiergetsupportinfo",
"prettierignore",
"prettierrc",
"prettylint",
"probot",
"progid",
"promisify",
"proto",
"quasis",
"quux",
"Raghuvir",
"Rasmus",
"Rattray",
@@ -307,19 +278,18 @@
"readlines",
"rebalance",
"rebeccapurple",
"Rects",
"recurse",
"recurses",
"refmt",
"regexes",
"reimplement",
"repo",
"Reimplement",
"repo's",
"REPONAME",
"repos",
"reselect",
"rhengles",
"ribaudo",
"roadmap",
"rreverser",
"Roadmap",
"ruleset",
"rulesets",
"sandhose",
@@ -327,49 +297,37 @@
"sbdchd",
"scandir",
"schemastore",
"serializer",
"serializers",
"serviceworker",
"Serializers",
"setlocal",
"setq",
"shellscape",
"shellsession",
"Shigeaki",
"Shinigami",
"Simen",
"simonhaenisch",
"singleline",
"skratchdot",
"smirea",
"socio",
"softline",
"softlines",
"Sorin",
"sosukesuzuki",
"squidfunk",
"srcset",
"Stachowiak",
"staged's",
"standalones",
"Stankiewicz",
"stringify",
"stubailo",
"starturl",
"styleguides",
"stylelint",
"stylelintrc",
"subfolder",
"subvalue",
"suchipi",
"superset",
"supertypes",
"swac",
"systemjs",
"tdeekens",
"templating",
"tempy",
"testname",
"tgriesser",
"tidelift",
"tidelift’s",
"Tidelift’s",
"tldr",
"Tomasek",
"Tradeshift",
@@ -377,31 +335,26 @@
"TSAs",
"tsep",
"TSJS",
"Typeahead",
"typeahead",
"typecasted",
"typecheck",
"typeof",
"udbff",
"udfff",
"ufffe",
"uffff",
"Umidbek",
"unaries",
"uncheck",
"Uncheck",
"uncook",
"unibeautify",
"unignore",
"uniqby",
"unist",
"unmount",
"Unmount",
"unparenthesised",
"unparenthesized",
"unparseable",
"unpause",
"unpkg",
"unrestrict",
"unstage",
"Unrestrict",
"unstaged",
"untracked",
"valourous",
"Vanderwerff",
"vanguarding",
@@ -414,31 +367,34 @@
"Vue's",
"Wadler",
"Wadler's",
"warrenseine",
"webstorm",
"whitespaces",
"xargs",
"yamafaktory",
"Yatharth",
"youtube",
"yuchi",
"Zatorski",
"Zeit",
"zimme",
"Zosel"
],
"ignoreRegExpList": [
"<!-- prettier-ignore -->\\n(`{3,})\\w*\\n[\\s\\S]+?\\1",
"\\[@\\w+?\\]",
"\\[(\\*{2})?@\\w+?\\1\\]",
"\\[`\\w+`\\]",
"ve{2,}r{2,}y",
"ve+r+y+long\\w*",
"\\/.*?\\/"
],
"ignorePaths": [
"cspell.json",
"**/node_modules/**",
"**/yarn.lock",
"{coverage,dist,.cache,.git,.vscode,.DS_Store,tests}/**/*",
"!tests/**/jsfmt.spec.js",
"*.{log,svg,snap}",
"test.*",
"website/data/users.yml",
"website/build/**",
"website/playground/codeSamples.js",
"website/pages/googlefe164a33bda4034b.html",
"website/static/lib/**",
"website/static/playground.js"
]
+1 -1
View File
@@ -125,7 +125,7 @@
"lint:changelog": "node ./scripts/lint-changelog.js",
"lint:prettier": "prettier \"**/*.{md,json,yml,html,css}\" --check",
"lint:dist": "eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:2016 \"dist/!(bin-prettier|index|third-party).js\"",
"lint:spellcheck": "cspell {bin,scripts,src,website}/**/*.js {docs,website/blog,changelog_unreleased}/**/*.md",
"lint:spellcheck": "cspell \"**/*\" \".github/**/*\"",
"lint:deps": "node ./scripts/check-deps.js",
"build": "node --max-old-space-size=3072 ./scripts/build/build.js",
"build-docs": "node ./scripts/build-docs.js"
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env node
"use strict";
const fs = require("fs");
const path = require("path");
const execa = require("execa");
const CSPELL_CONFIG_FILE = path.join(__dirname, "../cspell.json");
const updateConfig = (config) =>
fs.writeFileSync(CSPELL_CONFIG_FILE, JSON.stringify(config, undefined, 4));
(async () => {
console.log("Empty words ...");
const config = JSON.parse(fs.readFileSync(CSPELL_CONFIG_FILE, "utf8"));
updateConfig({ ...config, words: [] });
console.log("Running spellcheck with empty words ...");
try {
await execa("yarn lint:spellcheck");
} catch ({ stdout }) {
let words = [...stdout.matchAll(/ - Unknown word \((.*?)\)/g)].map(
([, word]) => word
);
// Unique
words = [...new Set(words)];
// Remove upper case word, if lower case one already exists
words = words.filter((word) => {
const lowerCased = word.toLowerCase();
return lowerCased === word || !words.includes(lowerCased);
});
// Compare function from https://github.com/streetsidesoftware/vscode-spell-checker/blob/2fde3bc5c658ee51da5a56580aa1370bf8174070/packages/client/src/settings/CSpellSettings.ts#L78
words = words.sort((a, b) =>
a.toLowerCase().localeCompare(b.toLowerCase())
);
config.words = words;
}
console.log("Updating words ...");
updateConfig(config);
console.log("Running spellcheck with new words ...");
const subprocess = execa("yarn lint:spellcheck");
subprocess.stdout.pipe(process.stdout);
await subprocess;
console.log("CSpell config file updated.");
})();
+5 -1
View File
@@ -51,7 +51,11 @@ describe("throw error with --help not-found", () => {
});
describe("show warning with --help not-found (typo)", () => {
runPrettier("cli", ["--help", "parserr"]).test({
runPrettier("cli", [
"--help",
// cspell:disable-next-line
"parserr",
]).test({
status: 0,
});
});
@@ -1 +1 @@
var x = 'this should not be formatterd';
var x = 'this should not be formatted';
@@ -1,2 +1,2 @@
var x = 'this should be formatterd';
var x = 'this should be formatted';
@@ -1 +1 @@
var x = 'this should not be formatterd';
var x = 'this should not be formatted';
@@ -1,2 +1,2 @@
var x = 'this should be formatterd';
var x = 'this should be formatted';