Skip to content

Commit

Permalink
Merge pull request #73 from 2i2c-org/eslint-upgrade
Browse files Browse the repository at this point in the history
Upgrade to ESLint 9.x
  • Loading branch information
yuvipanda authored Jan 29, 2025
2 parents f80b661 + 30ef46a commit f9708c1
Show file tree
Hide file tree
Showing 6 changed files with 4,933 additions and 15,870 deletions.
40 changes: 0 additions & 40 deletions .eslintrc.js

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,29 @@ jobs:

- name: Test
run: npm test

lint:
needs: prep
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js ${{ env.NODE }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE }}

- name: Cache node_modules
uses: actions/cache@v2
id: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Install
run: npm install

- name: Test
run: npm run lint
14 changes: 0 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,6 @@ repos:
hooks:
- id: flake8

# Lint: JS code
- repo: https://github.com/pre-commit/mirrors-eslint
rev: "v8.56.0" # Use the sha / tag you want to point at
hooks:
- id: eslint
files: \.jsx?$
types: [file]
exclude: jupyterhub_fancy_profiles/static
additional_dependencies:
# Duplicated from package.json's devDependencies, otherwise pre-commit.ci
# does not like it
- eslint@8.56.0
- eslint-plugin-react

# pre-commit.ci config reference: https://pre-commit.ci/#configuration
ci:
autoupdate_schedule: monthly
62 changes: 62 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import react from "eslint-plugin-react";
import globals from "globals";
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 [
{
files: ["**/src/**/*.js", "**/src/**/*.jsx"],
},
{
ignores: [
"jupyterhub_fancy_profiles/static/*.js",
"**/webpack.config.js",
"**/babel.config.js",
],
},
...compat.extends("eslint:recommended", "plugin:react/recommended"),
{
plugins: {
react,
},

languageOptions: {
globals: {
...globals.browser,
},

ecmaVersion: "latest",
sourceType: "module",
},

settings: {
react: {
version: "detect",
},
},

rules: {
"react/react-in-jsx-scope": "off",
"react/jsx-uses-react": "off",
// Temporarily turn off prop-types
"react/prop-types": "off",

"no-unused-vars": [
"error",
{
args: "after-used",
},
],
},
},
];
Loading

0 comments on commit f9708c1

Please sign in to comment.