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

Revert "Use ESLint 9 to lint libs/**" #1695

Merged
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
64 changes: 64 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// This is repo-wide base config for eslint. It's not used directly by any
// project, but is extended by each project's own eslint config.

module.exports = {
root: true,
// disable eslint on all files by default, for perf reasons
// re-enabled in each projects own eslint config (ignorePatterns: ['!**/*'])
ignorePatterns: ['**/*'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
},
overrides: [
{
files: ['*.js', '*.jsx', '*.mjs', '*.cjs'],
extends: ['@guardian/eslint-config'],
},
{
files: ['*.ts', '*.tsx', '*.mts', '*.cts', '*.d.ts'],
extends: ['@guardian/eslint-config-typescript'],
settings: {
'import/resolver': {
typescript: {
project: 'tsconfig.base.json',
},
},
},
},
{
files: ['.lintstagedrc.js'],
rules: {
'import/no-default-export': 'off',
},
},
{
files: ['rollup.config.js'],
rules: {
'import/no-default-export': 'off',
},
},
{
files: ['*.stories.*'],
rules: {
// stories require default exports
'import/no-default-export': 'off',
},
},
],
rules: {
'react/no-unknown-property': ['error', { ignore: ['css'] }],
},
extends: [
'plugin:storybook/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
settings: {
react: {
version: 'detect',
},
},
};
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ install: check-node-version
@guardian/source\:verify-dist: env
@corepack pnpm --filter @guardian/source verify-dist

.PHONY: @guardian/source\:wireit
@guardian/source\:wireit: env
@corepack pnpm --filter @guardian/source wireit

.PHONY: @guardian/source-development-kitchen\:build
@guardian/source-development-kitchen\:build: env
@corepack pnpm --filter @guardian/source-development-kitchen build
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/source:test`
- `make @guardian/source:tsc`
- `make @guardian/source:verify-dist`
- `make @guardian/source:wireit`

#### @guardian/source-development-kitchen

Expand Down
33 changes: 33 additions & 0 deletions libs/@guardian/ab-core/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
extends: ['../../../.eslintrc.cjs'],
ignorePatterns: [
'!**/*',
'node_modules',
'jest.dist.*', // depends on build output, so don't lint it
'dist',
'.wireit',
],
overrides: [
{
files: ['*.ts', '*.tsx'],
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {},
},
{
files: ['*.js', '*.jsx'],
rules: {},
},
{
files: ['*.test.*', 'jest.*'],
env: {
jest: true,
},
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
},
},
],
};
14 changes: 0 additions & 14 deletions libs/@guardian/ab-core/eslint.config.js

This file was deleted.

1 change: 1 addition & 0 deletions libs/@guardian/ab-core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ const config = {
testEnvironment: 'jest-environment-jsdom',
};

// eslint-disable-next-line import/no-default-export -- that's what jest likes
export default config;
4 changes: 2 additions & 2 deletions libs/@guardian/ab-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
"verify-dist": "wireit"
},
"devDependencies": {
"@guardian/eslint-config": "workspace:*",
"@types/jest": "29.5.8",
"eslint": "9.9.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"rollup": "4.21.0",
Expand Down Expand Up @@ -67,6 +65,7 @@
"command": "eslint --cache --color . --fix",
"files": [
"**",
"../../../.eslint*",
"!(dist)/**",
"!.eslintcache"
],
Expand All @@ -79,6 +78,7 @@
"command": "eslint --cache --color .",
"files": [
"**",
"../../../.eslint*",
"!(dist)/**",
"!.eslintcache"
],
Expand Down
33 changes: 33 additions & 0 deletions libs/@guardian/ab-react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
extends: ['../../../.eslintrc.cjs'],
ignorePatterns: [
'!**/*',
'node_modules',
'jest.dist.*', // depends on build output, so don't lint it
'dist',
'.wireit',
],
overrides: [
{
files: ['*.ts', '*.tsx'],
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {},
},
{
files: ['*.js', '*.jsx'],
rules: {},
},
{
files: ['*.test.*', 'jest.*'],
env: {
jest: true,
},
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
},
},
],
};
15 changes: 0 additions & 15 deletions libs/@guardian/ab-react/eslint.config.js

This file was deleted.

2 changes: 2 additions & 0 deletions libs/@guardian/ab-react/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable import/no-default-export -- that's what jest likes */

import { config as baseConfig } from '../../../configs/jest.config.js';

/** @typedef {import("jest").Config} Config */
Expand Down
4 changes: 2 additions & 2 deletions libs/@guardian/ab-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
},
"devDependencies": {
"@guardian/ab-core": "8.0.0",
"@guardian/eslint-config": "workspace:*",
"@testing-library/react": "14.2.1",
"@types/jest": "29.5.8",
"@types/react": "18.2.79",
"eslint": "9.9.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"react": "18.2.0",
Expand Down Expand Up @@ -90,6 +88,7 @@
],
"files": [
"**",
"../../../.eslint*",
"!(dist)/**",
"!.eslintcache"
],
Expand All @@ -105,6 +104,7 @@
],
"files": [
"**",
"../../../.eslint*",
"!(dist)/**",
"!.eslintcache"
],
Expand Down
24 changes: 24 additions & 0 deletions libs/@guardian/browserslist-config/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
extends: ['../../../.eslintrc.cjs'],
ignorePatterns: [
'!**/*',
'node_modules',
'jest.dist.*', // depends on build output, so don't lint it
'.wireit',
],
overrides: [
{
files: ['*.ts', '*.tsx'],
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {},
},
{
files: ['**/*.test.*'],
env: {
jest: true,
},
},
],
};
8 changes: 0 additions & 8 deletions libs/@guardian/browserslist-config/eslint.config.mjs

This file was deleted.

4 changes: 2 additions & 2 deletions libs/@guardian/browserslist-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
},
"devDependencies": {
"@guardian/browserslist-config": "workspace:*",
"@guardian/eslint-config": "workspace:*",
"browserslist": "4.23.0",
"eslint": "9.9.0",
"tslib": "2.6.2",
"wireit": "0.14.8"
},
Expand All @@ -34,6 +32,7 @@
"clean": false,
"files": [
"**",
"../../../.eslint*",
"!.eslintcache"
],
"output": [
Expand All @@ -44,6 +43,7 @@
"command": "eslint --cache --color .",
"files": [
"**",
"../../../.eslint*",
"!.eslintcache"
],
"output": []
Expand Down
6 changes: 1 addition & 5 deletions libs/@guardian/browserslist-config/scripts/usage-table.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { readFileSync } from 'fs';
import browserslistStats from '../browserslist-stats.json' assert { type: 'json' };
import { normaliseBrowserName } from './normalise-browser-name.mjs';

const browserslistStats = JSON.parse(
readFileSync('../browserslist-stats.json'),
);

const flattened = {};

// flatten the stats to { browserVersion: usage } shape
Expand Down
37 changes: 37 additions & 0 deletions libs/@guardian/core-web-vitals/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
extends: ['../../../.eslintrc.cjs'],
ignorePatterns: [
'!**/*',
'node_modules',
'jest.dist.*', // depends on build output, so don't lint it
'dist',
'.wireit',
],
overrides: [
{
files: ['*.ts', '*.tsx'],
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {},
},
{
files: ['*.ts', '*.tsx'],
rules: {},
},
{
files: ['*.js', '*.jsx'],
rules: {},
},
{
files: ['*.test.*', 'jest.*'],
env: {
jest: true,
},
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
},
},
],
};
14 changes: 0 additions & 14 deletions libs/@guardian/core-web-vitals/eslint.config.js

This file was deleted.

2 changes: 2 additions & 0 deletions libs/@guardian/core-web-vitals/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable import/no-default-export -- that's what jest likes */

import { config as baseConfig } from '../../../configs/jest.config.js';

/** @typedef {import("jest").Config} Config */
Expand Down
Loading