diff --git a/.eslintrc.cjs b/.eslintrc.cjs
deleted file mode 100644
index fca77337..00000000
--- a/.eslintrc.cjs
+++ /dev/null
@@ -1,94 +0,0 @@
-module.exports = {
- root: true,
- extends: ['react-app'],
- ignorePatterns: ['build/', 'dist/', 'docs/', 'node_modules/'],
- plugins: ['lodash'],
- rules: {
- 'lodash/import-scope': 2,
- 'import/no-cycle': 'error',
- 'comma-dangle': ['error', 'always-multiline'],
- 'prefer-destructuring': [
- 'error',
- {
- object: true,
- array: false,
- },
- ],
- indent: ['error', 2, { SwitchCase: 1 }],
- 'multiline-ternary': ['error', 'always'],
- 'space-in-parens': ['error', 'always'],
- 'no-warning-comments': [
- 'error',
- {
- terms: [ 'shortcut:' ],
- location: 'anywhere',
- },
- ],
- },
- overrides: [
- {
- // `yarn lint` does not include e2e, and that tree does not use the src parenthesis style.
- files: ['e2e/**/*.js'],
- rules: {
- 'space-in-parens': 'off',
- },
- },
- {
- files: ['**/*.{ts,tsx}'],
- rules: {
- '@typescript-eslint/consistent-type-imports': [
- 'error',
- {
- fixStyle: 'separate-type-imports',
- prefer: 'type-imports',
- },
- ],
- '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
- '@typescript-eslint/array-type': [
- 'error',
- {
- default: 'array',
- },
- ],
- '@typescript-eslint/no-explicit-any': 'error',
- 'import/consistent-type-specifier-style': [
- 'error',
- 'prefer-top-level',
- ],
- 'no-unused-vars': 'off',
- '@typescript-eslint/no-unused-vars': [
- 'error',
- {
- vars: 'all',
- args: 'after-used',
- argsIgnorePattern: '^_',
- varsIgnorePattern: '^_',
- ignoreRestSiblings: true,
- caughtErrors: 'all',
- caughtErrorsIgnorePattern: '^_',
- },
- ],
- },
- },
- {
- // Full typing under non-strict for all TypeScript (#67 main process, #236 page): typed catch, typed exports.
- files: ['src/**/*.{ts,tsx}'],
- rules: {
- '@typescript-eslint/explicit-module-boundary-types': 'error',
- 'no-restricted-syntax': [
- 'error',
- {
- selector: 'CatchClause[param][param.typeAnnotation=undefined]',
- message: 'Annotate catch bindings (use unknown).',
- },
- {
- selector:
- 'CatchClause BinaryExpression[operator="instanceof"][right.name="Error"]',
- message:
- 'Read (error as Error).message; jsdom Error is a different realm from Node throws.',
- },
- ],
- },
- },
- ],
-};
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 00000000..975e810a
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,80 @@
+import js from '@eslint/js';
+import stylistic from '@stylistic/eslint-plugin';
+import { defineConfig } from 'eslint/config';
+import { importX, createNodeResolver } from 'eslint-plugin-import-x';
+import lodash from 'eslint-plugin-lodash';
+import reactHooks from 'eslint-plugin-react-hooks';
+import globals from 'globals';
+import tseslint from 'typescript-eslint';
+
+export default defineConfig(
+ { ignores: [ 'build/', 'dist/', 'out/', 'docs/', 'node_modules/' ] },
+
+ js.configs.recommended,
+ tseslint.configs.recommended,
+ tseslint.configs.stylistic,
+
+ // Per-process globals. typescript-eslint turns `no-undef` off for TypeScript, so today these
+ // only bind for the two JavaScript config files; the blocks keep the process boundaries explicit.
+ { files: [ 'src/main/**' ], languageOptions: { globals: globals.node } },
+ { files: [ 'src/preload/**', 'src/preload-proofs/**' ], languageOptions: { globals: { ...globals.node, ...globals.browser } } },
+ { files: [ 'src/app/**', 'src/index.tsx', 'src/registerServiceWorker.ts' ], languageOptions: { globals: globals.browser } },
+ { files: [ 'src/**/*.test.{ts,tsx}', 'src/test/**' ], languageOptions: { globals: { ...globals.node, ...globals.browser } } },
+ { files: [ 'electron.vite.config.js', 'vitest.config.mjs', 'eslint.config.js' ], languageOptions: { globals: globals.node } },
+
+ // The repo's own style, on every linted file.
+ {
+ plugins: { '@stylistic': stylistic, 'import-x': importX, lodash },
+ settings: {
+ // Without the TypeScript extensions `import-x/no-cycle` resolves nothing and passes silently.
+ ...importX.flatConfigs.typescript.settings,
+ 'import-x/resolver-next': [ createNodeResolver( { extensions: [ '.ts', '.tsx', '.js', '.mjs', '.json' ] } ) ],
+ },
+ rules: {
+ 'lodash/import-scope': 'error',
+ 'import-x/no-cycle': 'error',
+ 'import-x/first': 'error',
+ 'prefer-destructuring': [ 'error', { object: true, array: false } ],
+ 'no-warning-comments': [ 'error', { terms: [ 'shortcut:' ], location: 'anywhere' } ],
+ eqeqeq: [ 'error', 'smart' ],
+ 'array-callback-return': 'error',
+ 'no-throw-literal': 'error',
+ 'no-self-compare': 'error',
+ 'no-template-curly-in-string': 'error',
+ 'no-useless-rename': 'error',
+ 'no-useless-computed-key': 'error',
+ 'no-useless-concat': 'error',
+ '@stylistic/indent': [ 'error', 2, { SwitchCase: 1 } ],
+ '@stylistic/comma-dangle': [ 'error', 'always-multiline' ],
+ '@stylistic/space-in-parens': [ 'error', 'always' ],
+ '@stylistic/multiline-ternary': [ 'error', 'always' ],
+ '@stylistic/semi': [ 'error', 'always' ],
+ '@stylistic/quotes': [ 'error', 'single', { avoidEscape: true } ],
+ },
+ },
+
+ // Page: the hooks rules, including the React Compiler ones.
+ { files: [ 'src/**/*.{ts,tsx}' ], ...reactHooks.configs.flat.recommended },
+
+ {
+ files: [ 'src/**/*.{ts,tsx}' ],
+ rules: {
+ // typescript-eslint turns this off for TypeScript.
+ 'no-unreachable': 'error',
+ '@typescript-eslint/consistent-type-imports': [ 'error', { fixStyle: 'separate-type-imports', prefer: 'type-imports' } ],
+ 'import-x/consistent-type-specifier-style': [ 'error', 'prefer-top-level' ],
+ '@typescript-eslint/no-useless-constructor': 'error',
+ '@typescript-eslint/no-unused-vars': [ 'error', {
+ vars: 'all',
+ args: 'after-used',
+ argsIgnorePattern: '^_',
+ varsIgnorePattern: '^_',
+ ignoreRestSiblings: true,
+ caughtErrors: 'all',
+ caughtErrorsIgnorePattern: '^_',
+ } ],
+ '@typescript-eslint/no-empty-function': 'off',
+ '@typescript-eslint/class-literal-property-style': 'off',
+ },
+ },
+);
diff --git a/package.json b/package.json
index dd5956ee..ff5a4cd2 100644
--- a/package.json
+++ b/package.json
@@ -86,16 +86,16 @@
},
"devDependencies": {
"@electron/notarize": "^3.1.2",
+ "@eslint/js": "^10.0.1",
"@sentry/bundler-plugins": "11.12.0",
"@sentry/cli": "^3.8.2",
+ "@stylistic/eslint-plugin": "^6.0.1",
"@types/d3-array": "^3.2.2",
"@types/lodash": "^4.17.27",
"@types/node": "^22.19.1",
"@types/prismjs": "^1.26.5",
"@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3",
- "@typescript-eslint/eslint-plugin": "^8",
- "@typescript-eslint/parser": "^8",
"@vitejs/plugin-react": "5.2.0",
"dotenv": "^17.4.2",
"download": "^8.0.0",
@@ -103,14 +103,17 @@
"electron-builder": "^24.13.3",
"electron-download": "^4.1.1",
"electron-vite": "^6.0.0",
- "eslint": "^8.57.0",
- "eslint-config-react-app": "7.0.1",
+ "eslint": "^10",
+ "eslint-plugin-import-x": "^4.18.1",
"eslint-plugin-lodash": "^8.1.0",
+ "eslint-plugin-react-hooks": "^7.1.1",
+ "globals": "^17.14.0",
"jsdom": "^29.1.1",
"npm-run-all": "^4.1.5",
"playwright": "^1.65.0",
"prettier": "^3.9.10",
"typescript": "^5.9.3",
+ "typescript-eslint": "^8.73.0",
"vite": "^8.3.7",
"vitest": "^5.1.1"
},
@@ -209,9 +212,5 @@
"publish": {
"provider": "github"
}
- },
- "resolutions": {
- "@typescript-eslint/eslint-plugin": "^8.72.1",
- "@typescript-eslint/parser": "^8.72.1"
}
}
diff --git a/src/app/AlignmentCard.tsx b/src/app/AlignmentCard.tsx
index 118d20d8..9a408704 100644
--- a/src/app/AlignmentCard.tsx
+++ b/src/app/AlignmentCard.tsx
@@ -156,7 +156,7 @@ function AlignmentCard( { alignment }: AlignmentCardProps ): React.JSX.Element {
component="span"
sx={{ color: ( theme ) => theme.palette.primary.secondaryText }}
>
- Parsing... {alignment.numSequencesParsed}{' '}
+ Parsing... {alignment.numSequencesParsed}{' '}
);
@@ -320,7 +320,7 @@ function AlignmentCard( { alignment }: AlignmentCardProps ): React.JSX.Element {
{alignment.modeltestLoading
? (
)
: null}
@@ -345,14 +345,14 @@ function AlignmentCard( { alignment }: AlignmentCardProps ): React.JSX.Element {
? null
: (
- Partition not complete, click{' '}
+ Partition not complete, click{' '}
- here
+ here
{' '}
- to edit.
+ to edit.
)}
@@ -399,7 +399,7 @@ function FinalAlignmentCard( {
component="span"
sx={{ color: ( theme ) => theme.palette.primary.secondaryText }}
>
- Parsing... {alignment.numSequencesParsed}{' '}
+ Parsing... {alignment.numSequencesParsed}{' '}
);
diff --git a/src/app/App.tsx b/src/app/App.tsx
index ef2bae47..fcc4d269 100644
--- a/src/app/App.tsx
+++ b/src/app/App.tsx
@@ -98,7 +98,7 @@ const App = (): React.JSX.Element => {
message = `Converted your ${run.convertedAlignmentFrom} alignment into fasta!`;
}
if ( run.modified ) {
- message = `Made a copy of your input file, because there were some issues!`;
+ message = 'Made a copy of your input file, because there were some issues!';
}
return (
{
>
{run.exitCode === 0
? 'Calculation finished!'
- : `Calculation cancelled!`}
+ : 'Calculation cancelled!'}
{fileModifiedSnack( run )}
diff --git a/src/app/AstralTreeCard.tsx b/src/app/AstralTreeCard.tsx
index 9a8c5c92..e94f4194 100644
--- a/src/app/AstralTreeCard.tsx
+++ b/src/app/AstralTreeCard.tsx
@@ -82,7 +82,7 @@ function AstralTreeCard( {
backgroundColor: ( theme ) => theme.palette.input.main,
border: ( theme ) => `1px solid ${theme.palette.input.darker}`,
}}
- label={"trees"}
+ label={'trees'}
color="secondary"
/>
}
diff --git a/src/app/Input.tsx b/src/app/Input.tsx
index d0e3c917..233eb792 100644
--- a/src/app/Input.tsx
+++ b/src/app/Input.tsx
@@ -160,7 +160,7 @@ const Input = ( { run }: InputProps ): React.JSX.Element => {
}}
onClick={run.loadAlignmentFiles}
>
- Load alignment
+ Load alignment
)
: null}
@@ -192,7 +192,7 @@ const Input = ( { run }: InputProps ): React.JSX.Element => {
}}
onClick={run.loadAstralTree}
>
- Load input trees
+ Load input trees
)}
@@ -220,7 +220,7 @@ const Input = ( { run }: InputProps ): React.JSX.Element => {
onClick={run.loadAlignmentFiles}
title="Concatenate new alignments and create partition"
>
- Add alignment
+ Add alignment
)}
@@ -258,7 +258,7 @@ const Input = ( { run }: InputProps ): React.JSX.Element => {
onClick={run.loadAlignmentFiles}
title="Concatenate new alignments and automatically generate a partition"
>
- Add alignment
+ Add alignment
)}
@@ -286,7 +286,7 @@ const Input = ( { run }: InputProps ): React.JSX.Element => {
onClick={run.loadPartitionFile}
title="Load a partition file for the current alignment"
>
- Load partition
+ Load partition
)}
@@ -340,7 +340,7 @@ const Input = ( { run }: InputProps ): React.JSX.Element => {
}}
onClick={run.loadTreeFile}
>
- Add Tree
+ Add Tree
)}
@@ -390,7 +390,7 @@ const Input = ( { run }: InputProps ): React.JSX.Element => {
}}
onClick={run.loadBackboneConstraintFile}
>
- Add Backbone Constraint
+ Add Backbone Constraint
)}
@@ -440,7 +440,7 @@ const Input = ( { run }: InputProps ): React.JSX.Element => {
}}
onClick={run.loadMultifurcatingConstraintFile}
>
- Add Multifurcating Constraint
+ Add Multifurcating Constraint
)}
diff --git a/src/app/Output.tsx b/src/app/Output.tsx
index 058662eb..cebe9cb3 100644
--- a/src/app/Output.tsx
+++ b/src/app/Output.tsx
@@ -106,7 +106,7 @@ const Output = ( { run }: OutputProps ): React.JSX.Element => {
? (
)
diff --git a/src/app/PartitionEditor.tsx b/src/app/PartitionEditor.tsx
index c5949032..9972e8be 100644
--- a/src/app/PartitionEditor.tsx
+++ b/src/app/PartitionEditor.tsx
@@ -188,7 +188,7 @@ function PartitionEditor( {
title="Clear partition entries"
onClick={partition.reset}
>
- Reset
+ Reset
)}
diff --git a/src/app/Raxml.tsx b/src/app/Raxml.tsx
index 50f7730d..cc2a4682 100644
--- a/src/app/Raxml.tsx
+++ b/src/app/Raxml.tsx
@@ -67,14 +67,14 @@ const Raxml = ( { run, store }: RaxmlProps ): React.JSX.Element => {
variant="outlined"
onClick={run.cancelModeltestOnAlignment}
>
- Cancel modeltest
+ Cancel modeltest
)
: null}
{run.running
? (
)
: null}
diff --git a/src/app/components/ErrorDialog.tsx b/src/app/components/ErrorDialog.tsx
index 2c817c06..12d06727 100644
--- a/src/app/components/ErrorDialog.tsx
+++ b/src/app/components/ErrorDialog.tsx
@@ -94,7 +94,7 @@ export default function ErrorDialog( {
color="secondary"
autoFocus
>
- Report issue on mail
+ Report issue on mail