Skip to content

Commit 1573f51

Browse files
authored
Merge pull request #3179 from OpenNeuroOrg/eslint-fixes
Linting refactor and enable GitHub actions
2 parents 87bf729 + dc70912 commit 1573f51

File tree

226 files changed

+2579
-2031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+2579
-2031
lines changed

.eslintignore

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

.eslintrc.json

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

.github/workflows/eslint.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: ESLint
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
eslint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Use Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20.x'
18+
- run: yarn install
19+
- run: yarn run lint

.pnp.cjs

Lines changed: 1067 additions & 732 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.mjs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// @ts-check
2+
import eslint from "@eslint/js"
3+
import tseslint from "typescript-eslint"
4+
import reactCompiler from "eslint-plugin-react-compiler"
5+
6+
export default tseslint.config({
7+
ignores: [
8+
"**/build/**",
9+
"**/dist/**",
10+
"**/node_modules/**",
11+
".yarn/*",
12+
".pnp.cjs",
13+
".pnp.loader.mjs",
14+
"**/coverage/**",
15+
"packages/openneuro-app/pluralize-esm.js",
16+
"packages/openneuro-app/src/scripts/utils/schema-validator.js",
17+
],
18+
}, {
19+
files: [
20+
"packages/**/*.ts",
21+
"packages/**/*.tsx",
22+
"packages/**/*.jsx",
23+
"packages/**/*.js",
24+
],
25+
extends: [
26+
eslint.configs.recommended,
27+
...tseslint.configs.recommended,
28+
],
29+
rules: {
30+
"@typescript-eslint/array-type": "error",
31+
"@typescript-eslint/consistent-type-imports": "error",
32+
"no-console": "error",
33+
"@typescript-eslint/no-unused-vars": [
34+
"error",
35+
{
36+
"argsIgnorePattern": "^_",
37+
"varsIgnorePattern": "^_",
38+
"caughtErrorsIgnorePattern": "^_",
39+
},
40+
],
41+
},
42+
}, {
43+
files: ["packages/**/*.tsx", "packages/**/*.jsx"],
44+
plugins: {
45+
"react-compiler": reactCompiler,
46+
},
47+
rules: {
48+
"react-compiler/react-compiler": "error",
49+
},
50+
}, {
51+
files: ["packages/**/*.js"],
52+
...tseslint.configs.disableTypeChecked,
53+
})

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "vitest",
88
"coverage": "vitest --coverage",
99
"ci-coverage": "vitest --coverage && codecov",
10-
"lint": "eslint --ext .jsx --ext .js --ext .ts --ext .tsx packages/*/src",
10+
"lint": "eslint",
1111
"openneuro": "node packages/openneuro-cli/src",
1212
"_postinstall": "husky install",
1313
"prepublish": "rm -fr packages/*/dist .build-cache/ && yarn build",
@@ -17,22 +17,18 @@
1717
},
1818
"devDependencies": {
1919
"@elastic/apm-rum-react": "2.0.2",
20+
"@eslint/js": "^9.13.0",
2021
"@sentry/cli": "1.37.4",
2122
"@testing-library/jest-dom": "6.1.3",
2223
"@types/ioredis-mock": "^8.2.2",
2324
"@types/jsdom": "^16",
2425
"@types/testing-library__jest-dom": "5.14.5",
25-
"@typescript-eslint/eslint-plugin": "^4.19.0",
26-
"@typescript-eslint/parser": "^4.19.0",
2726
"@vitest/coverage-v8": "^1.5.0",
2827
"@yarnpkg/pnpify": "^3.1.1-rc.8",
28+
"babel-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
2929
"codecov": "3.8.3",
30-
"eslint": "7.23.0",
31-
"eslint-config-prettier": "^8.1.0",
32-
"eslint-plugin-import": "^2.22.1",
33-
"eslint-plugin-prettier": "^3.3.1",
34-
"eslint-plugin-react": "^7.23.1",
35-
"eslint-plugin-react-hooks": "^4.2.0",
30+
"eslint": "^9.13.0",
31+
"eslint-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
3632
"graphql": "16.8.1",
3733
"history": "5.2.0",
3834
"husky": "5.1.1",
@@ -48,6 +44,7 @@
4844
"sass": "^1.56.1",
4945
"tsc-watch": "6.0.4",
5046
"typescript": "5.1.6",
47+
"typescript-eslint": "^8.11.0",
5148
"vite": "5.4.8",
5249
"vitest": "1.5.0",
5350
"vitest-fetch-mock": "0.2.2"

packages/openneuro-app/src/@types/react.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable */
12
import React from "react"
23

34
/**

packages/openneuro-app/src/scripts/app.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import React, { FC, ReactNode } from "react"
1+
import React from "react"
2+
import type { FC, ReactNode } from "react"
23
import Helmet from "react-helmet"
34
import { frontPage } from "./pages/front-page/front-page-content"
4-
import { Cookies, CookiesProvider } from "react-cookie"
5+
import type { Cookies } from "react-cookie"
6+
import { CookiesProvider } from "react-cookie"
57
import { ToastContainer } from "react-toastify"
68
import "react-toastify/dist/ReactToastify.css"
79
import { MediaContextProvider } from "./styles/media"

packages/openneuro-app/src/scripts/authentication/profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import jwtDecode from "jwt-decode"
22

3-
interface OpenNeuroTokenProfile {
3+
export interface OpenNeuroTokenProfile {
44
sub: string
55
email: string
66
provider: string

packages/openneuro-app/src/scripts/authentication/withProfile.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable */
21
import React from "react"
32
import { useCookies } from "react-cookie"
43
import { getProfile, guardExpired } from "./profile"

0 commit comments

Comments
 (0)