Skip to content

Commit 87e7d53

Browse files
authored
Merge pull request #280 from oclif/mdonnalley/eslint-9
chore(W-17692101): eslint 9
2 parents 6ab1e70 + b60a1d2 commit 87e7d53

File tree

10 files changed

+563
-319
lines changed

10 files changed

+563
-319
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc

Lines changed: 0 additions & 9 deletions
This file was deleted.

.prettierrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@oclif/prettier-config"

bin/dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ts-node
2-
// eslint-disable-next-line node/shebang
3-
(async () => {
2+
3+
;(async () => {
44
const oclif = await import('@oclif/core')
55
await oclif.execute({development: true, dir: __dirname})
66
})()

bin/run.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
void (async () => {
4-
const oclif = await import('@oclif/core')
5-
await oclif.execute({dir: __dirname})
6-
})()
3+
(async () => {
4+
const oclif = await import("@oclif/core");
5+
await oclif.execute({ dir: __dirname });
6+
})();

eslint.config.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {includeIgnoreFile} from '@eslint/compat'
2+
import oclif from 'eslint-config-oclif'
3+
import prettier from 'eslint-config-prettier'
4+
import path from 'node:path'
5+
import {fileURLToPath} from 'node:url'
6+
7+
const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore')
8+
9+
export default [
10+
includeIgnoreFile(gitignorePath),
11+
...oclif,
12+
prettier,
13+
{
14+
rules: {
15+
'@typescript-eslint/no-require-imports': 'off',
16+
'perfectionist/sort-objects': 'off',
17+
'unicorn/prefer-module': 'off',
18+
'unicorn/prefer-top-level-await': 'off',
19+
},
20+
},
21+
]

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"main": "dist/index.js",
1212
"repository": "oclif/plugin-test-cjs-1",
1313
"files": [
14-
"/bin",
14+
"bin",
1515
"/dist",
1616
"/npm-shrinkwrap.json",
1717
"/oclif.manifest.json"
@@ -22,14 +22,16 @@
2222
"@oclif/plugin-plugins": "^5"
2323
},
2424
"devDependencies": {
25+
"@eslint/compat": "^1.2.5",
26+
"@oclif/prettier-config": "^0.2.1",
2527
"@oclif/test": "^4",
2628
"@types/chai": "^4",
2729
"@types/mocha": "^10",
2830
"@types/node": "^16.18.125",
2931
"chai": "^4",
30-
"eslint": "^8.57.1",
31-
"eslint-config-oclif": "^5.2.2",
32-
"eslint-config-oclif-typescript": "^3.1.13",
32+
"eslint": "^9.19.0",
33+
"eslint-config-oclif": "^6.0.0",
34+
"eslint-config-prettier": "^10.0.1",
3335
"mocha": "^10",
3436
"oclif": "^4",
3537
"shx": "^0.3.4",
@@ -57,15 +59,15 @@
5759
},
5860
"scripts": {
5961
"build": "shx rm -rf dist && tsc -b",
60-
"lint": "eslint . --ext .ts --config .eslintrc",
62+
"lint": "eslint",
6163
"postpack": "shx rm -f oclif.manifest.json",
6264
"posttest": "yarn lint",
6365
"prepack": "yarn build && oclif manifest && oclif readme",
6466
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
6567
"version": "oclif readme && git add README.md"
6668
},
6769
"engines": {
68-
"node": ">=12.0.0"
70+
"node": ">=18.0.0"
6971
},
7072
"bugs": "https://github.com/oclif/plugin-test-cjs-1/issues",
7173
"keywords": [

src/commands/cjs1.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
Args, Command, Flags, Interfaces,
3-
} from '@oclif/core'
1+
import {Args, Command, Flags, Interfaces} from '@oclif/core'
42

53
type Result = {
64
args: Interfaces.InferredArgs<typeof CJS1.args>
@@ -17,9 +15,7 @@ export default class CJS1 extends Command {
1715
default: async () => 'async fn default',
1816
}),
1917
}
20-
2118
static enableJsonFlag = true
22-
2319
static flags = {
2420
optionalString: Flags.string(),
2521
defaultString: Flags.string({

test/helpers/init.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const path = require('path')
1+
const path = require('node:path')
22
process.env.TS_NODE_PROJECT = path.resolve('test/tsconfig.json')
33
process.env.NODE_ENV = 'development'
44

5-
global.oclif = global.oclif || {}
6-
global.oclif.columns = 80
5+
globalThis.oclif = globalThis.oclif || {}
6+
globalThis.oclif.columns = 80

0 commit comments

Comments
 (0)