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

Update eslint to v9 #5603

Merged
merged 27 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bdca0a5
chore: Update to eslint v9 with flat config
sidharthv96 Jun 12, 2024
871a13a
Merge branch 'develop' into sidv/eslintv9
sidharthv96 Jun 28, 2024
14622b0
squash! chore: Update to eslint v9 with flat config
aloisklink Jun 28, 2024
0ba712f
build(eslint): add tsconfig for all linted files
aloisklink Jun 28, 2024
3f2e823
chore: Remove orphaned files
sidharthv96 Jun 29, 2024
4a50feb
chore: Resolve eslint errors
sidharthv96 Jun 29, 2024
4c6e278
chore: Resolve eslint errors
sidharthv96 Jun 29, 2024
195e314
fix: Eslint jison linting
sidharthv96 Jun 29, 2024
51fc56b
chore: Remove max_old_space_size as v9 does not have perf issues
sidharthv96 Jun 29, 2024
6b87fb3
chore: Add type checked rules, auto fix
sidharthv96 Jun 29, 2024
d9b2934
chore: Fix eslint issues
sidharthv96 Jun 29, 2024
1fad9e6
chore: Fix eslint issues
sidharthv96 Jun 29, 2024
d9a1299
chore: Cleanup rules
sidharthv96 Jun 29, 2024
f1bd8fa
chore: Remove cross-env from eslint
sidharthv96 Jun 29, 2024
13bba48
chore: Remove unused variables
sidharthv96 Jun 29, 2024
501cdbf
Merge branch 'sidv/eslintv9' into sidv/eslintv9Typed
sidharthv96 Jun 29, 2024
d452533
chore: Organise imports
sidharthv96 Jun 30, 2024
7534462
chore: Use `??` instead of `||`
sidharthv96 Jun 30, 2024
cf72d33
fix: Message wrap
sidharthv96 Jun 30, 2024
29a3967
fix: Message wrap
sidharthv96 Jun 30, 2024
c8a3290
Merge branch 'develop' into sidv/eslintv9
sidharthv96 Jun 30, 2024
2efb256
Merge branch 'sidv/eslintv9' into sidv/eslintv9Typed
sidharthv96 Jun 30, 2024
d8d608f
chore: Remove extra words from cspell
sidharthv96 Jun 30, 2024
8b8c0dd
Apply suggestions from code review
sidharthv96 Jun 30, 2024
55bd9e6
chore: Fix lint
sidharthv96 Jun 30, 2024
b27d83e
Merge pull request #5608 from mermaid-js/sidv/eslintv9Typed
sidharthv96 Jun 30, 2024
f3a65f3
chore: Cleanup tsconfig
sidharthv96 Jun 30, 2024
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
13 changes: 10 additions & 3 deletions .build/types.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
/* eslint-disable no-console */
import { packageOptions } from './common.js';
import { execSync } from 'child_process';

const buildType = (packageName: string) => {
console.log(`Building types for ${packageName}`);
try {
const out = execSync(`tsc -p ./packages/${packageName}/tsconfig.json --emitDeclarationOnly`);
out.length > 0 && console.log(out.toString());
if (out.length > 0) {
console.log(out.toString());
}
} catch (e) {
console.error(e);
e.stdout.length > 0 && console.error(e.stdout.toString());
e.stderr.length > 0 && console.error(e.stderr.toString());
if (e.stdout.length > 0) {
console.error(e.stdout.toString());
}
if (e.stderr.length > 0) {
console.error(e.stderr.toString());
}
}
};

Expand Down
3 changes: 3 additions & 0 deletions .cspell/code-terms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ bqstring
BQUOTE
bramp
BRKT
brotli
callbackargs
callbackname
classdef
Expand Down Expand Up @@ -111,6 +112,7 @@ STYLECLASS
STYLEOPTS
subcomponent
subcomponents
subconfig
SUBROUTINEEND
SUBROUTINESTART
Subschemas
Expand All @@ -125,6 +127,7 @@ titlevalue
topbar
TRAPEND
TRAPSTART
treemap
ts-nocheck
tsdoc
typeof
Expand Down
1 change: 1 addition & 0 deletions .cspell/contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ cpettitt
Dong Cai
Nikolay Rozhkov
Peng Xiao
Per Brolin
subhash-halder
Vinod Sidharth
2 changes: 2 additions & 0 deletions .cspell/libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ pyplot
redmine
rehype
rscratch
shiki
sparkline
sphinxcontrib
ssim
stylis
Swimm
tsbuildinfo
tseslint
Tuleap
Typora
unocss
Expand Down
3 changes: 3 additions & 0 deletions .cspell/misc-terms.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
BRANDES
handdrawn
KOEPF
newbranch
10 changes: 6 additions & 4 deletions .esbuild/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { build } from 'esbuild';
import { mkdir, writeFile } from 'node:fs/promises';
import { packageOptions } from '../.build/common.js';
import { generateLangium } from '../.build/generateLangium.js';
import { MermaidBuildOptions, defaultOptions, getBuildConfig } from './util.js';
import type { MermaidBuildOptions } from './util.js';
import { defaultOptions, getBuildConfig } from './util.js';

const shouldVisualize = process.argv.includes('--visualize');

Expand Down Expand Up @@ -35,11 +36,11 @@ const buildPackage = async (entryName: keyof typeof packageOptions) => {

if (shouldVisualize) {
for (const { metafile } of results) {
if (!metafile) {
if (!metafile?.outputs) {
continue;
}
const fileName = Object.keys(metafile.outputs)
.filter((file) => !file.includes('chunks') && file.endsWith('js'))[0]
.find((file) => !file.includes('chunks') && file.endsWith('js'))
.replace('dist/', '');
// Upload metafile into https://esbuild.github.io/analyze/
await writeFile(`stats/${fileName}.meta.json`, JSON.stringify(metafile));
Expand All @@ -48,13 +49,14 @@ const buildPackage = async (entryName: keyof typeof packageOptions) => {
};

const handler = (e) => {
// eslint-disable-next-line no-console
console.error(e);
process.exit(1);
};

const main = async () => {
await generateLangium();
await mkdir('stats').catch(() => {});
await mkdir('stats', { recursive: true });
const packageNames = Object.keys(packageOptions) as (keyof typeof packageOptions)[];
// it should build `parser` before `mermaid` because it's a dependency
for (const pkg of packageNames) {
Expand Down
2 changes: 1 addition & 1 deletion .esbuild/jisonPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readFile } from 'node:fs/promises';
import { transformJison } from '../.build/jisonTransformer.js';
import { Plugin } from 'esbuild';
import type { Plugin } from 'esbuild';

export const jisonPlugin: Plugin = {
name: 'jison',
Expand Down
20 changes: 11 additions & 9 deletions .esbuild/server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import express from 'express';
import type { NextFunction, Request, Response } from 'express';
/* eslint-disable no-console */
import chokidar from 'chokidar';
import cors from 'cors';
import { getBuildConfig, defaultOptions } from './util.js';
import { context } from 'esbuild';
import chokidar from 'chokidar';
import { generateLangium } from '../.build/generateLangium.js';
import type { Request, Response } from 'express';
import express from 'express';
import { packageOptions } from '../.build/common.js';
import { generateLangium } from '../.build/generateLangium.js';
import { defaultOptions, getBuildConfig } from './util.js';

const configs = Object.values(packageOptions).map(({ packageName }) =>
getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: packageName })
Expand Down Expand Up @@ -40,7 +41,7 @@ const rebuildAll = async () => {
};

let clients: { id: number; response: Response }[] = [];
function eventsHandler(request: Request, response: Response, next: NextFunction) {
function eventsHandler(request: Request, response: Response) {
const headers = {
'Content-Type': 'text/event-stream',
Connection: 'keep-alive',
Expand All @@ -66,6 +67,7 @@ function handleFileChange() {
if (timeoutID !== undefined) {
clearTimeout(timeoutID);
}
// eslint-disable-next-line @typescript-eslint/no-misused-promises
timeoutID = setTimeout(async () => {
await rebuildAll();
sendEventsToAll();
Expand All @@ -86,14 +88,14 @@ async function createServer() {
ignoreInitial: true,
ignored: [/node_modules/, /dist/, /docs/, /coverage/],
})
// eslint-disable-next-line @typescript-eslint/no-misused-promises
.on('all', async (event, path) => {
// Ignore other events.
if (!['add', 'change'].includes(event)) {
return;
}
console.log(`${path} changed. Rebuilding...`);

if (/\.langium$/.test(path)) {
if (path.endsWith('.langium')) {
await generateLangium();
}
handleFileChange();
Expand All @@ -112,4 +114,4 @@ async function createServer() {
});
}

createServer();
void createServer();
2 changes: 1 addition & 1 deletion .esbuild/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => {
const external: string[] = ['require', 'fs', 'path'];
const { name, file, packageName } = packageOptions[entryName];
const outFileName = getFileName(name, options);
let output: BuildOptions = buildOptions({
const output: BuildOptions = buildOptions({
absWorkingDir: resolve(__dirname, `../packages/${packageName}`),
entryPoints: {
[outFileName]: `src/${file}`,
Expand Down
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

190 changes: 0 additions & 190 deletions .eslintrc.cjs

This file was deleted.

Loading
Loading