Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/witty-coins-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@scaleway/eslint-config-react': major
---

Migrate to eslint9
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

49 changes: 0 additions & 49 deletions .eslintrc

This file was deleted.

109 changes: 109 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import babelParser from "@babel/eslint-parser";
import scw from "@scaleway/eslint-config-react/javascript";
import scwTypescript from "@scaleway/eslint-config-react/typescript";
import globals from "globals";

export default [
{
ignores: [
"**/node_modules/",
"**/dist/",
"**/build/",
"**/__typetests__/",
"**/packages_deprecated/",
"**/coverage/",
],
},
{
languageOptions: {
globals: {
...globals.browser,
},
},
},
...scw.map((config) => ({ ...config, files: ["**/*.js"] })),
{
files: ["**/*.js"],

languageOptions: {
parser: babelParser,
parserOptions: {
configFile: "./babel.config.json",
},
},
},
...scwTypescript.map((config) => ({
...config,
files: ["**/*.ts", "**/*.tsx"],
})),

{
files: ["**/*.ts", "**/*.tsx"],

languageOptions: {
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
project: ["tsconfig.json"],
},
},
},
...scwTypescript.map((config) => ({
...config,
files: [
"packages/changesets-renovate/**/*.ts{x,}",
"packages/validate-icu-locales/**/*.ts{x,}",
"**/__tests__/**/*.ts{x,}",
],

languageOptions: {
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
project: ["tsconfig.json"],
},
},
})),
...scwTypescript.map((config) => ({
...config,
files: [
"packages/changesets-renovate/**/*.ts{x,}",
"packages/validate-icu-locales/**/*.ts{x,}",
"**/__tests__/**/*.ts{x,}",
],

languageOptions: {
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
project: ["tsconfig.json"],
},
},

rules: {
...config.rules,
"no-console": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-floating-promises": "warn",
},
})),

{
files: [
"packages/jest-helpers/**/*.ts{x,}",
"**/__tests__/**/*.ts{x,}",
"**/vitest.setup.ts",
"**/*.config.ts",
"**/__mocks__/**/*.ts{x,}",
],

rules: {
"import/no-extraneous-dependencies": "off",
"react/jsx-key": "off",
"import/no-relative-packages": "off",
},
},
];
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@changesets/cli": "2.27.5",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@eslint/eslintrc": "3.1.0",
"@scaleway/eslint-config-react": "workspace:*",
"@scaleway/tsconfig": "workspace:*",
"@testing-library/jest-dom": "6.4.6",
Expand All @@ -36,7 +37,8 @@
"builtin-modules": "4.0.0",
"cross-env": "7.0.3",
"esbuild-plugin-browserslist": "0.12.1",
"eslint": "8.57.0",
"eslint": "9.4.0",
"globals": "15.4.0",
"happy-dom": "14.12.0",
"husky": "9.0.11",
"lint-staged": "15.2.5",
Expand All @@ -51,7 +53,7 @@
"wait-for-expect": "3.0.2"
},
"scripts": {
"lint": "eslint --ext js,ts,tsx --cache .",
"lint": "eslint --cache .",
"lint:fix": "pnpm run lint --fix",
"build": "pnpm recursive run build",
"commit": "npx git-cz -a",
Expand Down
1 change: 0 additions & 1 deletion packages/changesets-renovate/__mocks__/simple-git.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { vi } from 'vitest'

export const defaultGitValues = {
Expand Down
15 changes: 0 additions & 15 deletions packages/eslint-config-react/emotion.js

This file was deleted.

24 changes: 24 additions & 0 deletions packages/eslint-config-react/emotion.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { rules } from '@emotion/eslint-plugin'
import { fixupPluginRules } from '@eslint/compat'

export default [
{
plugins: {
'@emotion': fixupPluginRules({ rules }),
},

rules: {
'react/no-unknown-property': [
'error',
{
ignore: ['css'],
},
],

'@emotion/import-from-emotion': 'error',
'@emotion/no-vanilla': 'error',
'@emotion/styled-import': 'error',
'@emotion/syntax-preference': ['error', 'string'],
},
},
]
6 changes: 0 additions & 6 deletions packages/eslint-config-react/index.js

This file was deleted.

5 changes: 5 additions & 0 deletions packages/eslint-config-react/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import emotion from "./emotion.mjs";
import javascript from "./javascript.mjs";
import typescript from "./typescript.mjs";

export { emotion, javascript, typescript };
28 changes: 28 additions & 0 deletions packages/eslint-config-react/javascript.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { fixupConfigRules } from "@eslint/compat";
import { FlatCompat } from "@eslint/eslintrc";
import airbnb from "eslint-config-airbnb";
import path from "node:path";
import { fileURLToPath } from "node:url";
import shared from "./shared.mjs";

const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

const compat = new FlatCompat({
baseDirectory: dirname,
});

export default [
...fixupConfigRules(compat.config(airbnb)),
...shared,
{
rules: {
"react/jsx-filename-extension": [
"error",
{
extensions: [".js"],
},
],
},
},
];
22 changes: 19 additions & 3 deletions packages/eslint-config-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,34 @@
"eslint",
"eslintconfig"
],
"main": "index.js",
"publishConfig": {
"access": "public"
},
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/scaleway/scaleway-lib",
"directory": "packages/eslint-config-react"
},
"exports": {
".": "./index.mjs",
"./javascript": "./javascript.mjs",
"./typescript": "./typescript.mjs",
"./emotion": "./emotion.mjs",
"./shared": "./shared.mjs"
},
"files": [
"index.mjs",
"javascript.mjs",
"typescript.mjs",
"shared.mjs",
"emotion.mjs"
],
"license": "MIT",
"dependencies": {
"@emotion/eslint-plugin": "11.11.0",
"@eslint/compat": "1.0.3",
"@eslint/eslintrc": "3.1.0",
"@typescript-eslint/eslint-plugin": "7.12.0",
"@typescript-eslint/parser": "7.12.0",
"eslint-config-airbnb": "19.0.4",
Expand All @@ -31,10 +47,10 @@
"eslint-plugin-react-hooks": "4.6.2"
},
"peerDependencies": {
"eslint": ">= 8.5"
"eslint": ">= 9.4"
},
"devDependencies": {
"eslint": "8.57.0",
"eslint": "9.4.0",
"typescript": "5.4.5"
}
}
Loading