Skip to content

fix no-useless-escape and prefer-spread eslint warnings #1683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ module.exports = {
],
},
],
'prefer-const': ['error', { destructuring: 'all' }],
"prefer-const": ["error", { destructuring: "all" }],
// TODO: fix below
"no-useless-escape": "off",
"prefer-rest-params": "off",
"prefer-spread": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",
Expand Down Expand Up @@ -87,8 +85,8 @@ module.exports = {
},
},
{
files: ['**/*.graphql'],
parser: '@graphql-eslint/eslint-plugin',
files: ["**/*.graphql"],
parser: "@graphql-eslint/eslint-plugin",
},
],
}
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
public
public/
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "next build && next-image-export-optimizer",
"dev": "next",
"format": "pnpm format:check --write",
"format:check": "prettier --cache --check \"**/*.{js,jsx,ts,tsx,json,md}\"",
"format:check": "prettier --cache --check \"**/*.{js,jsx,ts,tsx,cjs,mjs,json,yml,yaml,md}\"",
"lint": "eslint --ignore-path .gitignore .",
"postbuild": "next-sitemap --config next-sitemap.config.cjs",
"start": "next start",
Expand Down
2 changes: 1 addition & 1 deletion postcss.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = {
plugins: {
'tailwindcss/nesting': {},
"tailwindcss/nesting": {},
tailwindcss: {},
autoprefixer: {},
},
Expand Down
12 changes: 6 additions & 6 deletions src/components/marked/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,22 +430,22 @@ Lexer.prototype.token = function (src, top) {
*/

const inline = {
escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
escape: /^\\([\\`*{}[\]()#+\-.!_>])/,
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
url: noop,
tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
link: /^!?\[(inside)\]\(href\)/,
reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
nolink: /^!?\[((?:\[[^\]]*\]|[^[\]])*)\]/,
strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
br: /^ {2,}\n(?!\s*$)/,
del: noop,
text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,
text: /^[\s\S]+?(?=[\\<![_*`]| {2,}\n|$)/,
}

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

inline.link = replace(inline.link)("inside", inline._inside)(
Expand Down Expand Up @@ -602,7 +602,7 @@ InlineLexer.prototype.output = function (src) {
link = (cap[2] || cap[1]).replace(/\s+/g, " ")
link = this.links[link.toLowerCase()]
if (!link || !link.href) {
out.push.apply(out, this.output(cap[0][0]))
out.push(...this.output(cap[0][0]))
src = cap[0].substring(1) + src
continue
}
Expand Down Expand Up @@ -849,7 +849,7 @@ function replace(regex, opt) {
return function self(name, val) {
if (!name) return new RegExp(regex, opt)
val = val.source || val
val = val.replace(/(^|[^\[])\^/g, "$1")
val = val.replace(/(^|[^[])\^/g, "$1")
regex = regex.replace(name, val)
return self
}
Expand Down