Skip to content

Commit 6165a3e

Browse files
committed
Update to ESLint v9, use export default in the ESLint plugin.
1 parent f15b503 commit 6165a3e

File tree

6 files changed

+303
-298
lines changed

6 files changed

+303
-298
lines changed

.eslintrc.cjs

-66
This file was deleted.

eslint.config.js

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { readFileSync } from 'node:fs';
2+
import { join } from 'node:path';
3+
import nkzw from '@nkzw/eslint-config';
4+
import workspaces from 'eslint-plugin-workspaces';
5+
6+
export default [
7+
...nkzw,
8+
{
9+
ignores: ['packages/*/lib', 'packages/fbtee/lib-tmp/'],
10+
},
11+
{
12+
plugins: { workspaces },
13+
rules: {
14+
'@nkzw/no-instanceof': 0,
15+
'@typescript-eslint/array-type': [2, { default: 'generic' }],
16+
'import/no-extraneous-dependencies': [
17+
2,
18+
{
19+
devDependencies: [
20+
'./example/vite.config.ts',
21+
'./jest-preprocessor.js',
22+
'./packages/fbtee/babel-build.config.js',
23+
'**/__tests__/**/*.tsx',
24+
'eslint.config.js',
25+
],
26+
packageDir: [import.meta.dirname].concat(
27+
readFileSync('./pnpm-workspace.yaml', 'utf8')
28+
.split('\n')
29+
.slice(1)
30+
.map((n) =>
31+
join(
32+
import.meta.dirname,
33+
n
34+
.replaceAll(/\s*-\s+/g, '')
35+
.replaceAll("'", '')
36+
.replaceAll('\r', ''),
37+
),
38+
),
39+
),
40+
},
41+
],
42+
'import/no-unresolved': [
43+
2,
44+
{
45+
ignore: ['@typescript-eslint/*'],
46+
},
47+
],
48+
'unicorn/prefer-dom-node-append': 0,
49+
'workspaces/no-absolute-imports': 2,
50+
'workspaces/no-relative-imports': 2,
51+
},
52+
},
53+
{
54+
files: [
55+
'packages/babel-plugin-fbtee/src/bin/*.tsx',
56+
'packages/fbtee/babel-build.config.js',
57+
'**/__tests__/**/*.tsx',
58+
],
59+
rules: {
60+
'no-console': 0,
61+
'workspaces/no-relative-imports': 0,
62+
},
63+
},
64+
];

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@babel/types": "^7.26.3",
3131
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
3232
"@jest/globals": "30.0.0-alpha.6",
33-
"@nkzw/eslint-config": "^1.19.0",
33+
"@nkzw/eslint-config": "^2.0.0",
3434
"@testing-library/react": "^16.1.0",
3535
"@types/babel__core": "^7.20.5",
3636
"@types/babel__generator": "^7.6.8",
@@ -43,7 +43,7 @@
4343
"@types/react": "^19.0.4",
4444
"@types/react-dom": "^19.0.2",
4545
"@types/yargs": "^17.0.33",
46-
"eslint": "^8.0.0",
46+
"eslint": "^9.0.0",
4747
"eslint-plugin-workspaces": "^0.10.1",
4848
"invariant": "^2.2.4",
4949
"jest": "30.0.0-alpha.6",
@@ -61,7 +61,6 @@
6161
"updateConfig": {
6262
"ignoreDependencies": [
6363
"@types/prettier-2",
64-
"eslint",
6564
"prettier-2"
6665
]
6766
},

packages/eslint-plugin-fbtee/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nkzw/eslint-plugin-fbtee",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "",
55
"keywords": [],
66
"repository": {
@@ -14,6 +14,7 @@
1414
"import": "./lib/index.js",
1515
"require": "./lib/index.cjs"
1616
},
17+
"main": "lib/index.cjs",
1718
"scripts": {
1819
"build": "tsup src/index.tsx -d lib --target=node22 --format=esm,cjs --clean --no-splitting --dts"
1920
},

packages/eslint-plugin-fbtee/src/index.tsx

+22-22
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ import noEmptyStringsRule from './rules/no-empty-strings.tsx';
33
import noUnhelpfulDesc from './rules/no-unhelpful-desc.tsx';
44
import noUntranslatedStrings from './rules/no-untranslated-strings.tsx';
55

6-
export const meta = {
7-
name: packageJson.name,
8-
version: packageJson.version,
9-
};
10-
11-
export const rules = {
12-
'no-empty-strings': noEmptyStringsRule,
13-
'no-unhelpful-desc': noUnhelpfulDesc,
14-
'no-untranslated-strings': noUntranslatedStrings,
15-
};
16-
17-
export const configs = {
18-
recommended: {
19-
rules: {
20-
'@nkzw/fbtee/no-empty-strings': 2,
21-
'@nkzw/fbtee/no-unhelpful-desc': 2,
6+
export default {
7+
configs: {
8+
recommended: {
9+
rules: {
10+
'@nkzw/fbtee/no-empty-strings': 2,
11+
'@nkzw/fbtee/no-unhelpful-desc': 2,
12+
},
2213
},
23-
},
24-
strict: {
25-
rules: {
26-
'@nkzw/fbtee/no-empty-strings': 2,
27-
'@nkzw/fbtee/no-unhelpful-desc': 2,
28-
'@nkzw/fbtee/no-untranslated-strings': 2,
14+
strict: {
15+
rules: {
16+
'@nkzw/fbtee/no-empty-strings': 2,
17+
'@nkzw/fbtee/no-unhelpful-desc': 2,
18+
'@nkzw/fbtee/no-untranslated-strings': 2,
19+
},
2920
},
3021
},
22+
meta: {
23+
name: packageJson.name,
24+
version: packageJson.version,
25+
},
26+
rules: {
27+
'no-empty-strings': noEmptyStringsRule,
28+
'no-unhelpful-desc': noUnhelpfulDesc,
29+
'no-untranslated-strings': noUntranslatedStrings,
30+
},
3131
};

0 commit comments

Comments
 (0)