[repo]: add eslint to remark-alerts, langnostic and add new rules to config (#1455)

This commit is contained in:
Harshit Pant 2025-05-15 16:50:02 +05:30 committed by GitHub
parent dfc6b94ac1
commit fbec397716
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 97 additions and 53 deletions

View File

@ -3,8 +3,8 @@
"version": "0.0.1",
"type": "module",
"scripts": {
"check": "npm run tsc && npm run lint",
"build": "next build",
"check": "npm run tsc && eslint src",
"dev": "next dev",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
"start": "next start",

View File

@ -1,4 +1,5 @@
import { config } from '@gfe/eslint-config/next';
import formatjs from 'eslint-plugin-formatjs';
/** @type {import("eslint").Linter.Config} */
export default [
@ -11,4 +12,19 @@ export default [
},
},
},
{
plugins: {
formatjs,
},
rules: {
'formatjs/enforce-description': ['error', 'literal'],
'formatjs/enforce-id': [
'error',
{
idInterpolationPattern: '[sha512:contenthash:base64:6]',
},
],
'formatjs/enforce-default-message': ['error', 'literal'],
},
},
];

View File

@ -3,8 +3,8 @@
"version": "0.0.1",
"type": "module",
"scripts": {
"check": "npm run tsc && npm run lint",
"build": "npm run gen:all && next build && npm run sitemap && npm run upload-cdn",
"check": "npm run tsc && npm run lint ",
"cl": "contentlayer build",
"dev": "next dev --turbo",
"dev:wp": "next dev",
@ -101,6 +101,7 @@
"date-fns": "^4.1.0",
"esbuild": "^0.17.8",
"eslint": "^9.26.0",
"eslint-plugin-formatjs": "^5.3.1",
"fuse.js": "^7.1.0",
"gray-matter": "^4.0.3",
"jose": "^5.2.0",

View File

@ -54,6 +54,11 @@ export default tseslint.config(
rules: {
'perfectionist/sort-interfaces': 'warn',
'perfectionist/sort-enums': 'warn',
'perfectionist/sort-array-includes': 'warn',
'perfectionist/sort-objects': 'warn',
'perfectionist/sort-object-types': 'warn',
'perfectionist/sort-named-imports': 'warn',
'perfectionist/sort-named-exports': 'warn',
'perfectionist/sort-exports': 'warn',
'perfectionist/sort-imports': [
'warn',

View File

@ -6,7 +6,6 @@ import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import formatjs from 'eslint-plugin-formatjs';
import baseConfig from './index.js';
@ -81,19 +80,4 @@ export const config = [
],
},
},
{
plugins: {
formatjs,
},
rules: {
'formatjs/enforce-description': ['error', 'literal'],
'formatjs/enforce-id': [
'error',
{
idInterpolationPattern: '[sha512:contenthash:base64:6]',
},
],
'formatjs/enforce-default-message': ['error', 'literal'],
},
},
];

View File

@ -12,7 +12,6 @@
"@next/eslint-plugin-next": "14.2.15",
"eslint": "^9.26.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-formatjs": "^5.3.1",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-perfectionist": "^4.13.0",
"eslint-plugin-react": "^7.37.5",

View File

@ -0,0 +1,13 @@
import config from '@gfe/eslint-config';
/** @type {import("eslint").Linter.Config} */
export default [
...config,
{
languageOptions: {
parserOptions: {
project: './tsconfig.json',
},
},
},
];

View File

@ -13,8 +13,9 @@
"sideEffects": false,
"scripts": {
"build": "tsup",
"clean": "rimraf dist",
"lint": "eslint src --fix",
"dev": "tsup --watch",
"clean": "rimraf dist",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
"test": "vitest run",
"test:watch": "vitest",
@ -27,6 +28,8 @@
"@ai-sdk/google": "^1.2.3",
"@ai-sdk/openai": "^1.3.2",
"@clack/prompts": "^0.9.1",
"@gfe/eslint-config": "workspace:*",
"eslint": "9.26.0",
"ai": "^4.2.5",
"chalk": "^5.2.0",
"cosmiconfig": "^9.0.0",

View File

@ -9,5 +9,5 @@
"noEmit": true,
"types": ["vitest/globals"]
},
"include": ["src", "tsup.config.ts", "vitest.config.ts"]
"include": ["src", "tsup.config.ts", "vitest.config.ts", "eslint.config.js"]
}

View File

@ -0,0 +1,13 @@
import config from '@gfe/eslint-config';
/** @type {import("eslint").Linter.Config} */
export default [
...config,
{
languageOptions: {
parserOptions: {
project: './tsconfig.json',
},
},
},
];

View File

@ -1,17 +1,19 @@
{
"name": "@gfe/remark-alerts",
"version": "0.0.1",
"type": "module",
"description": "",
"module": "dist/index.mjs",
"types": "dist/index.d.mts",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.mts"
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"scripts": {
"build": "tsup",
"clean": "rimraf dist",
"lint": "eslint src --fix",
"dev": "tsup --watch",
"clean": "rimraf dist",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
"tsc": "tsc",
"verify": "npm run tsc && npm run build",
@ -29,6 +31,8 @@
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@gfe/eslint-config": "workspace:*",
"eslint": "9.26.0",
"@types/lodash-es": "^4.17.6",
"prettier": "3.5.3",
"rimraf": "^6.0.1",

View File

@ -42,7 +42,7 @@ type RemarkAlertsOptions = {
const remarkAlerts: Plugin<[RemarkAlertsOptions], Root> = ({
componentName = 'MDXAlert',
}: RemarkAlertsOptions = {}) => {
return (tree: any) => {
return (tree: Root) => {
visit(tree, 'blockquote', (node, index, parent) => {
if (index === undefined || !parent) {
return;

View File

@ -9,5 +9,5 @@
"esModuleInterop": true,
"noEmit": true
},
"include": ["src", "tsup.config.ts"]
"include": ["src", "tsup.config.ts", "eslint.config.js"]
}

View File

@ -430,6 +430,9 @@ importers:
eslint:
specifier: ^9.26.0
version: 9.26.0
eslint-plugin-formatjs:
specifier: ^5.3.1
version: 5.3.1(eslint@9.26.0)(typescript@5.8.3)
fuse.js:
specifier: ^7.1.0
version: 7.1.0
@ -764,9 +767,6 @@ importers:
eslint-config-prettier:
specifier: ^10.1.5
version: 10.1.5(eslint@9.26.0)
eslint-plugin-formatjs:
specifier: ^5.3.1
version: 5.3.1(eslint@9.26.0)(typescript@5.8.3)
eslint-plugin-only-warn:
specifier: ^1.1.0
version: 1.1.0
@ -806,6 +806,9 @@ importers:
'@clack/prompts':
specifier: ^0.9.1
version: 0.9.1
'@gfe/eslint-config':
specifier: workspace:*
version: link:../eslint-config
ai:
specifier: ^4.2.5
version: 4.2.5(react@18.2.0)(zod@3.24.3)
@ -818,6 +821,9 @@ importers:
dotenv:
specifier: ^16.3.1
version: 16.3.1
eslint:
specifier: 9.26.0
version: 9.26.0
globby:
specifier: ^13.2.2
version: 13.2.2
@ -895,9 +901,15 @@ importers:
specifier: ^5.0.0
version: 5.0.0
devDependencies:
'@gfe/eslint-config':
specifier: workspace:*
version: link:../eslint-config
'@types/lodash-es':
specifier: ^4.17.6
version: 4.17.12
eslint:
specifier: 9.26.0
version: 9.26.0
prettier:
specifier: 3.5.3
version: 3.5.3
@ -4132,11 +4144,13 @@ packages:
'@formatjs/intl-localematcher': 0.6.1
decimal.js: 10.4.3
tslib: 2.8.1
dev: false
/@formatjs/fast-memoize@2.2.7:
resolution: {integrity: sha512-Yabmi9nSvyOMrlSeGGWDiH7rf3a7sIwplbvo/dlz9WCIjzIQAfy1RMf4S0X3yG724n5Ghu2GmEl5NJIV6O9sZQ==}
dependencies:
tslib: 2.8.1
dev: false
/@formatjs/icu-messageformat-parser@2.11.2:
resolution: {integrity: sha512-AfiMi5NOSo2TQImsYAg8UYddsNJ/vUEv/HaNqiFjnI3ZFfWihUtD5QtuX6kHl8+H+d3qvnE/3HZrfzgdWpsLNA==}
@ -4144,17 +4158,20 @@ packages:
'@formatjs/ecma402-abstract': 2.3.4
'@formatjs/icu-skeleton-parser': 1.8.14
tslib: 2.8.1
dev: false
/@formatjs/icu-skeleton-parser@1.8.14:
resolution: {integrity: sha512-i4q4V4qslThK4Ig8SxyD76cp3+QJ3sAqr7f6q9VVfeGtxG9OhiAk3y9XF6Q41OymsKzsGQ6OQQoJNY4/lI8TcQ==}
dependencies:
'@formatjs/ecma402-abstract': 2.3.4
tslib: 2.8.1
dev: false
/@formatjs/intl-localematcher@0.6.1:
resolution: {integrity: sha512-ePEgLgVCqi2BBFnTMWPfIghu6FkbZnnBVhO2sSxvLfrdFw7wCHAHiDoM2h4NRgjbaY7+B7HgOLZGkK187pZTZg==}
dependencies:
tslib: 2.8.1
dev: false
/@formatjs/intl@3.1.6(typescript@5.8.3):
resolution: {integrity: sha512-tDkXnA4qpIFcDWac8CyVJq6oW8DR7W44QDUBsfXWIIJD/FYYen0QoH46W7XsVMFfPOVKkvbufjboZrrWbEfmww==}
@ -4187,7 +4204,7 @@ packages:
json-stable-stringify: 1.3.0
tslib: 2.8.1
typescript: 5.8.3
dev: true
dev: false
/@grpc/grpc-js@1.9.12:
resolution: {integrity: sha512-Um5MBuge32TS3lAKX02PGCnFM4xPT996yLgZNb5H03pn6NyJ4Iwn5YcPq6Jj9yxGRk7WOgaZFtVRH5iTdYBeUg==}
@ -7627,7 +7644,7 @@ packages:
deprecated: This is a stub types definition. json-stable-stringify provides its own type definitions, so you do not need this installed.
dependencies:
json-stable-stringify: 1.3.0
dev: true
dev: false
/@types/jsonwebtoken@9.0.5:
resolution: {integrity: sha512-VRLSGzik+Unrup6BsouBeHsf4d1hOEgYWTm/7Nmw1sXoN1+tRly/Gy/po3yeahnP4jfnQWWAhQAqcNfH7ngOkA==}
@ -7678,7 +7695,7 @@ packages:
resolution: {integrity: sha512-v1DKRfUdyW+jJhZNEI1PYy29S2YRxMV5AOO/x/SjKmW0acCIOqmbj6Haf9eHAhsPmrhlHSxEhv/1WszcLWV4cg==}
dependencies:
undici-types: 6.21.0
dev: true
dev: false
/@types/parse-json@4.0.2:
resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==}
@ -7694,7 +7711,7 @@ packages:
/@types/picomatch@3.0.2:
resolution: {integrity: sha512-n0i8TD3UDB7paoMMxA3Y65vUncFJXjcUf7lQY7YyKGl6031FNjfsLs6pdLFCy2GNFxItPJG8GvvpbZc2skH7WA==}
dev: true
dev: false
/@types/prismjs@1.26.4:
resolution: {integrity: sha512-rlAnzkW2sZOjbqZ743IHUhFcvzaGbqijwOu8QZnZCjfQzBqFE3s4lOTJEsxikImav9uzz/42I+O7YUs1mWgMlg==}
@ -7847,7 +7864,6 @@ packages:
dependencies:
'@typescript-eslint/types': 8.32.1
'@typescript-eslint/visitor-keys': 8.32.1
dev: true
/@typescript-eslint/type-utils@8.32.0(eslint@9.26.0)(typescript@5.8.3):
resolution: {integrity: sha512-t2vouuYQKEKSLtJaa5bB4jHeha2HJczQ6E5IXPDPgIty9EqcJxpr1QHQ86YyIPwDwxvUmLfP2YADQ5ZY4qddZg==}
@ -7874,7 +7890,6 @@ packages:
/@typescript-eslint/types@8.32.1:
resolution: {integrity: sha512-YmybwXUJcgGqgAp6bEsgpPXEg6dcCyPyCSr0CAAueacR/CCBi25G3V8gGQ2kRzQRBNol7VQknxMs9HvVa9Rvfg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
dev: true
/@typescript-eslint/typescript-estree@8.32.0(typescript@5.8.3):
resolution: {integrity: sha512-pU9VD7anSCOIoBFnhTGfOzlVFQIA1XXiQpH/CezqOBaDppRwTglJzCC6fUQGpfwey4T183NKhF1/mfatYmjRqQ==}
@ -7912,7 +7927,6 @@ packages:
typescript: 5.8.3
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/utils@8.32.0(eslint@9.26.0)(typescript@5.8.3):
resolution: {integrity: sha512-8S9hXau6nQ/sYVtC3D6ISIDoJzS1NsCK+gluVhLN2YkBPX+/1wkwyUiDKnxRh15579WoOIyVWnoyIf3yGI9REw==}
@ -7946,7 +7960,6 @@ packages:
typescript: 5.8.3
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/visitor-keys@8.32.0:
resolution: {integrity: sha512-1rYQTCLFFzOI5Nl0c8LUpJT8HxpwVRn9E4CkMsYfuN6ctmQqExjSTzzSk0Tz2apmXy7WU6/6fyaZVVA/thPN+w==}
@ -7962,7 +7975,6 @@ packages:
dependencies:
'@typescript-eslint/types': 8.32.1
eslint-visitor-keys: 4.2.0
dev: true
/@upstash/qstash@2.7.23:
resolution: {integrity: sha512-Xnq33GEjofV+To1MTN0bVesS/Q/oe5keLYcyPU6drnqmNjZZY/qvNR5jl7JwKGiXsbTxJwVC/ldAX51wadUvSA==}
@ -8927,7 +8939,6 @@ packages:
es-define-property: 1.0.1
get-intrinsic: 1.3.0
set-function-length: 1.2.2
dev: true
/call-bound@1.0.4:
resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==}
@ -9660,6 +9671,7 @@ packages:
/decimal.js@10.4.3:
resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==}
dev: false
/decode-named-character-reference@1.0.2:
resolution: {integrity: sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==}
@ -9694,7 +9706,6 @@ packages:
es-define-property: 1.0.1
es-errors: 1.3.0
gopd: 1.2.0
dev: true
/define-properties@1.2.1:
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
@ -9888,6 +9899,7 @@ packages:
/emoji-regex@10.3.0:
resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==}
dev: false
/emoji-regex@8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
@ -10444,7 +10456,7 @@ packages:
- supports-color
- ts-jest
- typescript
dev: true
dev: false
/eslint-plugin-only-warn@1.1.0:
resolution: {integrity: sha512-2tktqUAT+Q3hCAU0iSf4xAN1k9zOpjK5WO8104mB0rT/dGhOa09582HN5HlbxNbPRZ0THV7nLGvzugcNOSjzfA==}
@ -11480,7 +11492,6 @@ packages:
resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==}
dependencies:
es-define-property: 1.0.1
dev: true
/has-proto@1.0.1:
resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==}
@ -12270,7 +12281,6 @@ packages:
/isarray@2.0.5:
resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==}
dev: true
/isexe@2.0.0:
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
@ -12573,7 +12583,7 @@ packages:
isarray: 2.0.5
jsonify: 0.0.1
object-keys: 1.1.1
dev: true
dev: false
/json-stringify-safe@5.0.1:
resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==}
@ -12602,7 +12612,7 @@ packages:
/jsonify@0.0.1:
resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==}
dev: true
dev: false
/jsprim@1.4.2:
resolution: {integrity: sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==}
@ -14293,7 +14303,6 @@ packages:
/object-keys@1.1.1:
resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==}
engines: {node: '>= 0.4'}
dev: true
/object.assign@4.1.5:
resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==}
@ -14637,7 +14646,6 @@ packages:
/picomatch@4.0.2:
resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==}
engines: {node: '>=12'}
dev: true
/pify@2.3.0:
resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==}
@ -16492,7 +16500,6 @@ packages:
get-intrinsic: 1.3.0
gopd: 1.0.1
has-property-descriptors: 1.0.2
dev: true
/set-function-name@2.0.1:
resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==}
@ -17515,7 +17522,6 @@ packages:
typescript: '>=4.8.4'
dependencies:
typescript: 5.8.3
dev: true
/ts-easing@0.2.0:
resolution: {integrity: sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ==}
@ -17890,13 +17896,13 @@ packages:
/undici-types@6.21.0:
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
dev: true
dev: false
/unicode-emoji-utils@1.2.0:
resolution: {integrity: sha512-djUB91p/6oYpgps4W5K/MAvM+UspoAANHSUW495BrxeLRoned3iNPEDQgrKx9LbLq93VhNz0NWvI61vcfrwYoA==}
dependencies:
emoji-regex: 10.3.0
dev: true
dev: false
/unicorn-magic@0.1.0:
resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==}