Skip to content

Commit 16a6925

Browse files
authored
[Dependencies] Upgrade devDependencies, update eslint and jest configs, and add .nvmrc (#746)
1. Upgrade devDependencies to avoid issues with deprecated packages 2. Migrate eslint config from .eslintrc.cjs to eslint.config.cjs 3. Update Jest config to ignore examples 4. Add .nvmrc to use node version >= 24
1 parent ed368d7 commit 16a6925

File tree

14 files changed

+2686
-1551
lines changed

14 files changed

+2686
-1551
lines changed

.eslintignore

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

.eslintrc.cjs

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

.github/workflows/linter.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Node.js
1919
uses: actions/setup-node@v3
2020
with:
21-
node-version: '16'
21+
node-version: '24'
2222

2323
- name: Install dependencies
2424
run: npm install

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v24.11.1

eslint.config.cjs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const {
2+
defineConfig,
3+
globalIgnores,
4+
} = require("eslint/config");
5+
6+
const tsParser = require("@typescript-eslint/parser");
7+
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
8+
const js = require("@eslint/js");
9+
10+
const {
11+
FlatCompat,
12+
} = require("@eslint/eslintrc");
13+
14+
const compat = new FlatCompat({
15+
baseDirectory: __dirname,
16+
recommendedConfig: js.configs.recommended,
17+
allConfig: js.configs.all
18+
});
19+
20+
module.exports = defineConfig([{
21+
extends: compat.extends(
22+
"eslint:recommended",
23+
"plugin:@typescript-eslint/recommended",
24+
"plugin:prettier/recommended",
25+
),
26+
27+
languageOptions: {
28+
parser: tsParser,
29+
},
30+
31+
plugins: {
32+
"@typescript-eslint": typescriptEslint,
33+
},
34+
35+
rules: {
36+
"@typescript-eslint/no-explicit-any": "off",
37+
"@typescript-eslint/no-empty-function": "off",
38+
"@typescript-eslint/no-non-null-assertion": "off",
39+
},
40+
}, {
41+
files: ["examples/**/*.js", "examples/**/*.ts"],
42+
43+
"rules": {
44+
"no-undef": "off",
45+
"@typescript-eslint/no-unused-vars": "off",
46+
},
47+
}, globalIgnores([
48+
"**/dist",
49+
"**/debug",
50+
"**/lib",
51+
"**/build",
52+
"**/node_modules",
53+
"**/3rdparty",
54+
"**/.eslintrc.cjs",
55+
"**/.next",
56+
])]);

examples/chrome-extension/src/popup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
21
"use strict";
32

43
// This code is partially adapted from the openai-chatgpt-chrome-extension repo:

examples/simple-chat-ts/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Due to the differences in command-line tools between Unix/Linux and Windows syst
1919
### Steps for Windows Users
2020

2121
1. **Create a Node.js Script File**:
22-
2322
- In the `examples\simple-chat` directory, create a file named `copy-config.js`.
2423
- Add the following code to handle file copying:
2524
```javascript
@@ -29,7 +28,6 @@ Due to the differences in command-line tools between Unix/Linux and Windows syst
2928
```
3029

3130
2. **Modify `package.json`**:
32-
3331
- In the `scripts` section of your `package.json`, replace Unix-style `cp` commands with our new Node.js script. For example:
3432
```json
3533
"scripts": {

examples/simple-chat-upload/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Due to the differences in command-line tools between Unix/Linux and Windows syst
1919
### Steps for Windows Users
2020

2121
1. **Create a Node.js Script File**:
22-
2322
- In the `examples\simple-chat` directory, create a file named `copy-config.js`.
2423
- Add the following code to handle file copying:
2524
```javascript
@@ -29,7 +28,6 @@ Due to the differences in command-line tools between Unix/Linux and Windows syst
2928
```
3029

3130
2. **Modify `package.json`**:
32-
3331
- In the `scripts` section of your `package.json`, replace Unix-style `cp` commands with our new Node.js script. For example:
3432
```json
3533
"scripts": {

jest.config.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
module.exports = {
22
preset: "ts-jest",
33
testEnvironment: "node",
4+
roots: ["<rootDir>/tests", "<rootDir>/src"],
5+
modulePathIgnorePatterns: ["<rootDir>/examples/"],
46
};

0 commit comments

Comments
 (0)