Skip to content

Commit

Permalink
New: Migrate ESLint configuration to new format and compatible with l…
Browse files Browse the repository at this point in the history
…egacy
  • Loading branch information
1aron committed Nov 25, 2024
1 parent 2eb07fa commit 632548d
Show file tree
Hide file tree
Showing 8 changed files with 1,379 additions and 860 deletions.
1 change: 0 additions & 1 deletion .eslintrc.yml

This file was deleted.

6 changes: 6 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import tseslint from 'typescript-eslint'
import techor from 'eslint-config-techor'

export default tseslint.config(
techor.configs.recommended
)
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,32 @@
"@techor/jest": "workspace:^",
"@techor/jest-dom": "workspace:^",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.12.8",
"@types/node": "^20.17.7",
"commitlint-config-techor": "workspace:^",
"conventional-changelog-techor": "workspace:^",
"eslint": "^8.57.0",
"eslint": "^9.15.0",
"eslint-config-techor": "workspace:^",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-hooks": "^5.0.0",
"jest-environment-jsdom": "^29.7.0",
"jest-puppeteer": "^10.0.1",
"jest-puppeteer": "^10.1.4",
"parent-module": "^3.1.0",
"puppeteer": "^22.7.1",
"rollup": "^4.17.2",
"puppeteer": "^22.15.0",
"rollup": "^4.27.4",
"semantic-release-config-techor": "workspace:^",
"strip-ansi": "^7.1.0",
"tmp": "^0.2.3",
"ts-dedent": "^2.2.0",
"tsx": "^4.8.2",
"typescript": "^5.4.5"
"tsx": "^4.19.2",
"typescript": "^5.0.0"
},
"dependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-swc": "^0.3.0",
"@rollup/plugin-commonjs": "^25.0.8",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-swc": "^0.3.1",
"@rollup/plugin-typescript": "^11.1.6",
"@rollup/pluginutils": "^5.1.0",
"@rollup/pluginutils": "^5.1.3",
"cross-env": "^7.0.3",
"get-tsconfig": "^4.7.2",
"ts-jest": "^29.1.2"
"get-tsconfig": "^4.8.1",
"ts-jest": "^29.2.5"
}
}
1 change: 1 addition & 0 deletions packages/cross-import/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function crossImport(modulePath: string): any {
} catch { /* empty */ }
try {
if (process.env.DEBUG) console.log('[cross-import] require:', modulePath)
// eslint-disable-next-line @typescript-eslint/no-require-imports
return require(modulePath)
} catch (error) {
if (process.env.DEBUG) {
Expand Down
25 changes: 25 additions & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/no-require-imports */

const recommended = require('./recommended')

/** @type {import('@typescript-eslint/utils/ts-eslint').ClassicConfig} */
module.exports = {
configs: {
recommended
},
env: recommended.languageOptions.globals,
overrides: [],
parserOptions: {
ecmaVersion: recommended.languageOptions.ecmaVersion,
sourceType: recommended.languageOptions.sourceType
},
rules: recommended.rules,
ignorePatterns: recommended.ignores,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
}
12 changes: 7 additions & 5 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@
"config",
"typescript"
],
"main": ".eslintrc.js",
"main": "./index.js",
"files": [
".eslintrc.js"
"./index.js",
"./recommended.js"
],
"dependencies": {
"@typescript-eslint/eslint-plugin": "",
"@typescript-eslint/parser": ""
"@eslint/js": "",
"typescript-eslint": ""
},
"peerDependencies": {
"eslint": "*"
"eslint": "*",
"typescript": "*"
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
/* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/no-require-imports */
const eslint = require('@eslint/js')
const tseslint = require('typescript-eslint')

module.exports = {
env: {
node: true,
browser: true,
es2021: true,
jest: true
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
eslint.configs.recommended,
tseslint.configs.recommended,
],
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
globals: {
node: true,
browser: true,
es2021: true,
jest: true
},
},
plugins: [
'@typescript-eslint'
ignores: [
'dist/**'
],
rules: {
'linebreak-style': 0,
Expand All @@ -37,9 +39,7 @@ module.exports = {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off'
},
ignorePatterns: [
'dist'
]
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-expressions': 'off'
}
}
Loading

0 comments on commit 632548d

Please sign in to comment.