Skip to content

Commit 58c0aa2

Browse files
authored
Merge pull request #1317 from guardian/tf-lint-fixes
eslint fixes
2 parents 0fadcd8 + d0dfbab commit 58c0aa2

32 files changed

+90
-72
lines changed

cdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "jest",
88
"test-update": "jest -u",
99
"format": "prettier --write \"{lib,bin}/**/*.ts\"",
10-
"lint": "eslint lib/** bin/** --ext .ts --no-error-on-unmatched-pattern",
10+
"lint": "eslint lib/** bin/** --no-error-on-unmatched-pattern",
1111
"synth": "cdk synth --path-metadata false --version-reporting false",
1212
"diff": "cdk diff --path-metadata false --version-reporting false"
1313
},

eslint.config.mjs

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,48 @@
11
import guardian from '@guardian/eslint-config';
2+
import globals from 'globals';
23

34
export default [
45
{
56
ignores: [
67
'node_modules',
78
'dist',
9+
'server-dist',
810

9-
'customize.js',
1011
'rollup.config.js',
1112
'webpack.*js',
13+
'cdk',
1214
],
1315
},
1416
...guardian.configs.recommended,
1517
...guardian.configs.jest,
1618
{
19+
ignores: ['eslint.config.mjs'],
20+
languageOptions: {
21+
globals: {
22+
...globals.jest,
23+
...globals.browser,
24+
...globals.node,
25+
},
26+
ecmaVersion: 5,
27+
sourceType: 'commonjs',
28+
parserOptions: {
29+
project: ['./tsconfig.json'],
30+
tsconfigRootDir: './',
31+
},
32+
},
1733
rules: {
1834
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
1935
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
2036
curly: 2,
21-
'@typescript-eslint/no-inferrable-types': [
22-
'error',
23-
{
24-
ignoreParameters: true,
25-
},
26-
],
27-
'@typescript-eslint/no-unused-vars': [
28-
'error',
29-
{
30-
args: 'after-used',
31-
ignoreRestSiblings: true,
32-
},
33-
],
37+
// '@typescript-eslint/no-unused-vars': [
38+
// 'error',
39+
// {
40+
// args: 'after-used',
41+
// ignoreRestSiblings: true,
42+
// },
43+
// ],
3444

35-
// potentially to fix later see https://trello.com/c/lc8lG7Zj
45+
// potentially to fix later see https://trello.com/c/lc8lG7Zj
3646
'@typescript-eslint/naming-convention': 'off',
3747
'@eslint-community/eslint-comments/require-description': 'off',
3848
'@typescript-eslint/ban-types': 'off',
@@ -44,7 +54,6 @@ export default [
4454
'@typescript-eslint/require-await': 'off',
4555
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
4656
'@typescript-eslint/no-unsafe-argument': 'off',
47-
'@typescript-eslint/no-unnecessary-condition': 'off',
4857
'@typescript-eslint/no-unsafe-return': 'off',
4958
'@typescript-eslint/no-base-to-string': 'off',
5059
'@typescript-eslint/prefer-promise-reject-errors': 'off',
@@ -53,6 +62,8 @@ export default [
5362
'@typescript-eslint/no-unused-vars': 'off',
5463
'@typescript-eslint/restrict-template-expressions': 'off',
5564
'@typescript-eslint/no-floating-promises': 'off',
65+
'@typescript-eslint/prefer-optional-chain': 'off',
66+
'@typescript-eslint/await-thenable': 'off',
5667
},
5768
},
58-
];
69+
];

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"build-dotcom-types": "tsc --project tsconfig.types.json",
2222
"publish-dry-run": "pnpm publish --dry-run",
2323
"publish": "pnpm publish",
24-
"lint": "eslint 'src/**/*.{ts,tsx}'",
24+
"lint": "eslint .",
2525
"test": "export stage=DEV; jest",
2626
"riffraff": "node-riffraff-artifact"
2727
},
@@ -52,6 +52,7 @@
5252
"eslint-plugin-prettier": "5.1.3",
5353
"eslint-plugin-react": "^7.33.2",
5454
"fishery": "^0.3.0",
55+
"globals": "15.14.0",
5556
"inquirer": "^7.0.3",
5657
"jest": "^29.7.0",
5758
"nodemon": "^3.1.7",

pnpm-lock.yaml

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

src/dotcom/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export { getEpicViewLog, logEpicView } from '../shared/lib/viewLog';
21
export { getWeeklyArticleHistory, incrementWeeklyArticleCount } from '../shared/lib/history';
32
export {
43
replaceNonArticleCountPlaceholders,

src/dotcom/requests.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import {
1+
import type {
22
BannerPayload,
33
BannerProps,
44
EpicPayload,
55
EpicProps,
6-
HeaderPayload,
7-
HeaderProps,
86
GutterPayload,
97
GutterProps,
8+
HeaderPayload,
9+
HeaderProps,
1010
} from '../shared/types';
11-
12-
import { TestTracking } from '../shared/types/abTests/shared';
11+
import type { TestTracking } from '../shared/types/abTests/shared';
1312

1413
export interface ModuleData<PROPS> {
1514
name: string;

src/server/bandit/banditSelection.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { EpicTest } from '../../shared/types';
2-
import { BanditData } from './banditData';
1+
import type { EpicTest } from '../../shared/types';
2+
import type { BanditData } from './banditData';
33
import { selectVariantWithHighestMean } from './banditSelection';
44

55
const epicTest: EpicTest = {

src/server/factories/bannerDesign.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { BannerDesignFromTool, HexColour } from '../../shared/types';
21
import { Factory } from 'fishery';
2+
import type { BannerDesignFromTool, HexColour } from '../../shared/types';
33

44
const hexColourStringRegex = /^([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;
55
const stringToHexColour = (colourString: string): HexColour => {

src/server/factories/bannerVariant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { BannerVariant } from '../../shared/types';
21
import { Factory } from 'fishery';
2+
import type { BannerVariant } from '../../shared/types';
33

44
export default Factory.define<BannerVariant>(() => ({
55
name: 'Example Banner Variant',

src/server/factories/epicVariant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { EpicVariant } from '../../shared/types';
21
import { Factory } from 'fishery';
2+
import type { EpicVariant } from '../../shared/types';
33

44
export default Factory.define<EpicVariant>(() => ({
55
name: 'Example Variant',

0 commit comments

Comments
 (0)