Skip to content

Commit 557ddaa

Browse files
authored
Merge pull request #604 from evolvedbinary/eslint/new-setup
New ESLint setup
2 parents 4bc1c28 + 249a06c commit 557ddaa

24 files changed

Lines changed: 756 additions & 254 deletions

.eslintignore

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

.eslintrc

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

eslint.config.mts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*!
2+
Copyright (C) 2020 Evolved Binary
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU Affero General Public License as
6+
published by the Free Software Foundation, either version 3 of the
7+
License, or (at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU Affero General Public License for more details.
13+
14+
You should have received a copy of the GNU Affero General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
import js from "@eslint/js";
19+
import globals from "globals";
20+
import tseslint from "typescript-eslint";
21+
import { defineConfig } from "eslint/config";
22+
import notice from "eslint-plugin-notice";
23+
import tsdoc from "eslint-plugin-tsdoc";
24+
import { fileURLToPath } from "url";
25+
import path, { dirname } from "path";
26+
27+
const __filename = fileURLToPath(import.meta.url);
28+
const __dirname = dirname(__filename);
29+
30+
export default defineConfig([
31+
{
32+
ignores: [
33+
"**/dist/**",
34+
"**/node_modules/**",
35+
"**/coverage/**"
36+
]
37+
},
38+
39+
// JS base config
40+
{
41+
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
42+
plugins: { js },
43+
extends: ["js/recommended"],
44+
languageOptions: {
45+
globals: { ...globals.browser, ...globals.node }
46+
}
47+
},
48+
49+
tseslint.configs.recommended,
50+
{
51+
plugins: {
52+
notice,
53+
tsdoc
54+
},
55+
rules: {
56+
"@typescript-eslint/no-unused-vars": [
57+
"error",
58+
{
59+
"args": "all",
60+
"argsIgnorePattern": "^_",
61+
"caughtErrors": "all",
62+
"caughtErrorsIgnorePattern": "^_",
63+
"destructuredArrayIgnorePattern": "^_",
64+
"varsIgnorePattern": "^_",
65+
"ignoreRestSiblings": true
66+
}
67+
],
68+
// notice
69+
"notice/notice": [
70+
"error",
71+
{ templateFile: path.resolve(__dirname, "./config/notice.js") }
72+
],
73+
74+
// tsdoc
75+
"tsdoc/syntax": "warn"
76+
}
77+
},
78+
{
79+
files: ["**/*.spec.ts"],
80+
rules: {
81+
"@typescript-eslint/no-unused-expressions": "off",
82+
},
83+
}
84+
]);

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@
2929
"build:demo": "yarn workspace @evolvedbinary/prosemirror-lwdita-demo build",
3030
"build": "yarn workspace @evolvedbinary/prosemirror-lwdita-localization build && yarn workspace @evolvedbinary/prosemirror-lwdita build",
3131
"prepack": "yarn run build",
32+
"lint": "yarn workspaces foreach -A run lint",
3233
"test": "yarn workspace @evolvedbinary/prosemirror-lwdita-localization test && yarn workspace @evolvedbinary/prosemirror-lwdita test && yarn workspace @evolvedbinary/prosemirror-lwdita-backend test",
3334
"test:demo": "yarn workspace @evolvedbinary/prosemirror-lwdita-demo test",
3435
"coverage": "yarn workspace @evolvedbinary/prosemirror-lwdita-localization coverage && yarn workspace @evolvedbinary/prosemirror-lwdita coverage && yarn workspace @evolvedbinary/prosemirror-lwdita-backend coverage",
3536
"coveralls": "yarn workspace @evolvedbinary/prosemirror-lwdita-localization coveralls && yarn workspace @evolvedbinary/prosemirror-lwdita coveralls",
3637
"generate-docs": "yarn workspace @evolvedbinary/prosemirror-lwdita-localization generate-docs && yarn workspace @evolvedbinary/prosemirror-lwdita generate-docs",
37-
"lint": "eslint packages/* --ext .ts",
38-
"lint:fix": "eslint packages/* --ext .ts --fix",
3938
"start:backend": "yarn workspace @evolvedbinary/prosemirror-lwdita-backend start",
4039
"publish": "yarn workspace @evolvedbinary/prosemirror-lwdita-localization npm publish --access public && yarn workspace @evolvedbinary/prosemirror-lwdita npm publish --access public"
4140
},
@@ -50,17 +49,18 @@
5049
"packages/prosemirror-lwdita-backend"
5150
],
5251
"devDependencies": {
53-
"@eslint/js": "^9.13.0",
52+
"@eslint/js": "^9.38.0",
5453
"@tsconfig/recommended": "^1.0.7",
5554
"@types/node": "^24.9.2",
5655
"@typescript-eslint/eslint-plugin": "^8.11.0",
5756
"@typescript-eslint/parser": "^8.11.0",
58-
"eslint": "^8.57.0",
57+
"eslint": "^9.38.0",
5958
"eslint-plugin-notice": "^1.0.0",
60-
"eslint-plugin-tsdoc": "^0.3.0",
61-
"globals": "^16.5.0",
59+
"eslint-plugin-tsdoc": "^0.4.0",
60+
"globals": "^16.4.0",
61+
"jiti": "^2.6.1",
6262
"rimraf": "^6.0.1",
63-
"typescript-eslint": "^8.11.0"
63+
"typescript-eslint": "^8.46.2"
6464
},
6565
"packageManager": "yarn@4.2.2"
6666
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*!
2+
Copyright (C) 2020 Evolved Binary
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU Affero General Public License as
6+
published by the Free Software Foundation, either version 3 of the
7+
License, or (at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU Affero General Public License for more details.
13+
14+
You should have received a copy of the GNU Affero General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
import rootConfig from "../../eslint.config.mjs";
19+
import { defineConfig } from "eslint/config";
20+
import globals from "globals";
21+
22+
export default defineConfig([
23+
...rootConfig,
24+
{
25+
files: ["src/**/*.ts"],
26+
languageOptions: {
27+
globals: { ...globals.node }
28+
},
29+
rules: {
30+
// Backend-specific rules
31+
"@typescript-eslint/no-var-requires": "off"
32+
}
33+
}
34+
]);

packages/prosemirror-lwdita-backend/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"test": "mocha",
1414
"coverage": "rimraf coverage && nyc yarn mocha",
1515
"coveralls": "nyc --reporter=text-lcov report | coveralls",
16-
"dist": "webpack"
16+
"dist": "webpack",
17+
"lint": "eslint"
1718
},
1819
"engines": {
1920
"node": ">=22.16.0 <23",
@@ -60,15 +61,11 @@
6061
"@types/sinon": "^17.0.3",
6162
"@types/sinon-chai": "^4.0.0",
6263
"@types/supertest": "^6.0.2",
63-
"@typescript-eslint/eslint-plugin": "^8.11.0",
64-
"@typescript-eslint/parser": "^8.11.0",
6564
"chai": "^6.2.0",
6665
"chai-as-promised": "^8.0.2",
6766
"cors": "^2.8.5",
6867
"coveralls": "^3.1.1",
69-
"eslint": "^8.57.0",
70-
"eslint-plugin-notice": "^1.0.0",
71-
"eslint-plugin-tsdoc": "^0.3.0",
68+
"eslint": "^9.38.0",
7269
"mocha": "^10.7.3",
7370
"nyc": "^17.0.0",
7471
"rimraf": "^6.0.1",

packages/prosemirror-lwdita-backend/src/api/modules/octokit.module.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ const createBranch = async (octokit: Octokit, owner: string, newOwner: string, r
167167
const lastCommitSha = branchData.commit.sha;
168168

169169
// create the new branch based on upstream
170-
const { data: refData } = await octokit.git.createRef({
170+
const { data: _refData } = await octokit.git.createRef({
171171
owner: newOwner,
172172
repo,
173173
ref: `refs/heads/${newBranch}`,
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"target": "ES2022",
54
"rootDir": "src",
65
"outDir": "dist",
7-
"module": "Node16",
8-
"moduleResolution": "Node16",
6+
"composite": true,
7+
"declaration": true,
8+
"declarationMap": true,
99
},
10-
"exclude": [
11-
"tests/*"
12-
]
10+
"include": [
11+
"src/**/*",
12+
],
13+
"references": [] // no internal package dependencies
1314
}

packages/prosemirror-lwdita-backend/webpack.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*!
2+
Copyright (C) 2020 Evolved Binary
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU Affero General Public License as
6+
published by the Free Software Foundation, either version 3 of the
7+
License, or (at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU Affero General Public License for more details.
13+
14+
You should have received a copy of the GNU Affero General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
19+
// eslint-disable-next-line @typescript-eslint/no-require-imports
120
const path = require('path');
221

322
module.exports = {

packages/prosemirror-lwdita-demo/docker.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*!
2+
Copyright (C) 2020 Evolved Binary
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU Affero General Public License as
6+
published by the Free Software Foundation, either version 3 of the
7+
License, or (at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU Affero General Public License for more details.
13+
14+
You should have received a copy of the GNU Affero General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
/* eslint-disable @typescript-eslint/no-require-imports */
119
const fs = require('fs');
220
const path = require('path');
321
const buildTimeStamp = new Date().toISOString();

0 commit comments

Comments
 (0)