Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to ESLint 9 #465

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

41 changes: 0 additions & 41 deletions .eslintrc

This file was deleted.

67 changes: 67 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import notice from "eslint-plugin-notice";
import tsdoc from "eslint-plugin-tsdoc";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: [
"**/node_modules/",
"**/dist/",
"**/generated-docs/",
"packages/prosemirror-lwdita-demo/docker.js",
"packages/prosemirror-lwdita/scripts/fix.js"
],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
), {
files: ["**/*.ts", "**/*.tsx"],

languageOptions: {
parser: tsParser,
},

plugins: {
"@typescript-eslint": typescriptEslint,
notice,
tsdoc,
},

rules: {
"@typescript-eslint/no-empty-interface": 0,
"tsdoc/syntax": "warn",

"notice/notice": ["error", {
templateFile: "config/notice.js",
}],

"@typescript-eslint/no-unused-vars": ["error", {
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
}],
},
}, {
files: ["**/*.spec.ts"],

rules: {
"@typescript-eslint/no-unused-expressions": "off",
},
}];
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"test:demo": "yarn workspace @evolvedbinary/prosemirror-lwdita-demo test",
"coverage": "yarn workspace @evolvedbinary/prosemirror-lwdita coverage",
"coveralls": "yarn workspace @evolvedbinary/prosemirror-lwdita coveralls",
"generate-docs": "yarn workspace @evolvedbinary/prosemirror-lwdita generate-docs",
"lint": "eslint packages/* --ext .ts",
"lint:fix": "eslint packages/* --ext .ts --fix",
"generate-docs": "yarn workspace @evolvedbinary/prosemirror-lwdita generate-docs && yarn workspace @evolvedbinary/prosemirror-lwdita-backend generate-docs",
"lint": "eslint packages/*",
"lint:fix": "eslint packages/* --fix",
"start:backend": "yarn workspace @evolvedbinary/prosemirror-lwdita-backend start",
"test:backend": "yarn workspace @evolvedbinary/prosemirror-lwdita-backend test",
"clean:backend": "yarn workspace @evolvedbinary/prosemirror-lwdita-backend run clean"
Expand All @@ -54,7 +54,7 @@
"@tsconfig/recommended": "^1.0.7",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"eslint": "^8.57.0",
"eslint": "^9.13.0",
"eslint-plugin-notice": "^1.0.0",
"eslint-plugin-tsdoc": "^0.3.0",
"globals": "^15.11.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/prosemirror-lwdita-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"serve": "node ./dist/server.js",
"clean": "rimraf dist",
"build": "tsc",
"test": "mocha"
"test": "mocha",
"generate-docs": "typedoc"
},
"engines": {
"node": ">=20.1.0 <21",
Expand Down Expand Up @@ -71,6 +72,8 @@
"sinon-chai": "^4.0.0",
"supertest": "^7.0.0",
"ts-node": "^10.9.2",
"typedoc": "^0.26.10",
"typedoc-plugin-missing-exports": "^3.0.0",
"typescript": "^5.6.3"
},
"packageManager": "[email protected]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const createFork = async (octokit: Octokit, owner: string, repo: string): Promis
const createBranch = async (octokit: Octokit, owner: string, repo: string, branch: string, newBranch: string): Promise<BranchInfo | undefined> => {
try {
// get the repo data
const { data: repoData } = await octokit.repos.get({
const { _data: repoData } = await octokit.repos.get({
owner, // this should be the authenticated user name
repo,
});
Expand All @@ -160,7 +160,7 @@ const createBranch = async (octokit: Octokit, owner: string, repo: string, branc

//TODO(YB): Check if the branch already exists
// create the new branch
const { data: refData } = await octokit.git.createRef({
const { _data: refData } = await octokit.git.createRef({
owner,
repo,
ref: `refs/heads/${newBranch}`,
Expand Down
21 changes: 21 additions & 0 deletions packages/prosemirror-lwdita-backend/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["./src/server.ts"],
"exclude": ["generated-docs/**/*.ts", "dist/**/*.ts", "node_modules/**/*.ts"],
"out": "generated-docs",
"treatWarningsAsErrors": true,
"highlightLanguages": [
"bash",
"console",
"css",
"html",
"javascript",
"json",
"jsonc",
"json5",
"tsx",
"typescript",
"xml"
],
"plugin": ["typedoc-plugin-missing-exports"]
}
1 change: 0 additions & 1 deletion packages/prosemirror-lwdita/src/untravel-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ function getJditaNodeName(type: string): string {
* @param prosemirrorDocument - prosemirror document
* @returns JDita node
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function createMediaJDITAObject(nodeName: string, attributes: Record<string, string>, children: JDita[]): JDita {
if (nodeName === 'video') {
// we must populate the video node with the necessary attributes and children
Expand Down
10 changes: 10 additions & 0 deletions packages/prosemirror-lwdita/tsdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"extends": ["typedoc/tsdoc.json"],
"tagDefinitions": [
{
"tagName": "@decorator",
"syntaxKind": "block"
}
]
}
17 changes: 16 additions & 1 deletion packages/prosemirror-lwdita/typedoc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["./src/index.ts"],
"exclude": ["generated-docs/**/*.ts", "dist/**/*.ts", "node_modules/**/*.ts"],
"out": "generated-docs",
"treatWarningsAsErrors": true,
}
"highlightLanguages": [
"bash",
"console",
"css",
"html",
"javascript",
"json",
"jsonc",
"json5",
"tsx",
"typescript",
"xml"
],
"plugin": ["typedoc-plugin-missing-exports"]
}
Loading