Skip to content

Commit 941410f

Browse files
authoredMar 31, 2024
fix no-useless-escape and prefer-spread eslint warnings (graphql#1683)
* fix `no-useless-escape` and `prefer-spread` eslint warnings * format
1 parent a7557f7 commit 941410f

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed
 

‎.eslintrc.cjs

+3-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ module.exports = {
3333
],
3434
},
3535
],
36-
'prefer-const': ['error', { destructuring: 'all' }],
36+
"prefer-const": ["error", { destructuring: "all" }],
3737
// TODO: fix below
38-
"no-useless-escape": "off",
3938
"prefer-rest-params": "off",
40-
"prefer-spread": "off",
4139
"@typescript-eslint/no-explicit-any": "off",
4240
"@typescript-eslint/no-unused-vars": "off",
4341
"@typescript-eslint/ban-ts-comment": "off",
@@ -87,8 +85,8 @@ module.exports = {
8785
},
8886
},
8987
{
90-
files: ['**/*.graphql'],
91-
parser: '@graphql-eslint/eslint-plugin',
88+
files: ["**/*.graphql"],
89+
parser: "@graphql-eslint/eslint-plugin",
9290
},
9391
],
9492
}

‎.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
public
1+
public/
2+
pnpm-lock.yaml

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "next build && next-image-export-optimizer",
99
"dev": "next",
1010
"format": "pnpm format:check --write",
11-
"format:check": "prettier --cache --check \"**/*.{js,jsx,ts,tsx,json,md}\"",
11+
"format:check": "prettier --cache --check \"**/*.{js,jsx,ts,tsx,cjs,mjs,json,yml,yaml,md}\"",
1212
"lint": "eslint --ignore-path .gitignore .",
1313
"postbuild": "next-sitemap --config next-sitemap.config.cjs",
1414
"start": "next start",

‎postcss.config.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module.exports = {
44
plugins: {
5-
'tailwindcss/nesting': {},
5+
"tailwindcss/nesting": {},
66
tailwindcss: {},
77
autoprefixer: {},
88
},

‎src/components/marked/index.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -430,22 +430,22 @@ Lexer.prototype.token = function (src, top) {
430430
*/
431431

432432
const inline = {
433-
escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
433+
escape: /^\\([\\`*{}[\]()#+\-.!_>])/,
434434
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
435435
url: noop,
436436
tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
437437
link: /^!?\[(inside)\]\(href\)/,
438438
reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
439-
nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
439+
nolink: /^!?\[((?:\[[^\]]*\]|[^[\]])*)\]/,
440440
strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
441441
em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
442442
code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
443443
br: /^ {2,}\n(?!\s*$)/,
444444
del: noop,
445-
text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,
445+
text: /^[\s\S]+?(?=[\\<![_*`]| {2,}\n|$)/,
446446
}
447447

448-
inline._inside = /(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/
448+
inline._inside = /(?:\[[^\]]*\]|[^\]]|\](?=[^[]*\]))*/
449449
inline._href = /\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/
450450

451451
inline.link = replace(inline.link)("inside", inline._inside)(
@@ -602,7 +602,7 @@ InlineLexer.prototype.output = function (src) {
602602
link = (cap[2] || cap[1]).replace(/\s+/g, " ")
603603
link = this.links[link.toLowerCase()]
604604
if (!link || !link.href) {
605-
out.push.apply(out, this.output(cap[0][0]))
605+
out.push(...this.output(cap[0][0]))
606606
src = cap[0].substring(1) + src
607607
continue
608608
}
@@ -849,7 +849,7 @@ function replace(regex, opt) {
849849
return function self(name, val) {
850850
if (!name) return new RegExp(regex, opt)
851851
val = val.source || val
852-
val = val.replace(/(^|[^\[])\^/g, "$1")
852+
val = val.replace(/(^|[^[])\^/g, "$1")
853853
regex = regex.replace(name, val)
854854
return self
855855
}

0 commit comments

Comments
 (0)
Please sign in to comment.