Skip to content

Commit cd54814

Browse files
authored
Merge pull request #1785 from isaacphysics/hotfix/autoprune-eslint-suppressions
Don't break build when a suppression is fixed
2 parents 5922f23 + b63e720 commit cd54814

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,20 @@
1414

1515
The web interface is a [React app](https://github.com/facebook/create-react-app), served by [nginx](https://nginx.org/en/) in [Docker](https://www.docker.com/).
1616
The front-end application was initially generated from [create-react-app](https://github.com/facebook/create-react-app).
17+
18+
## eslint policies
19+
Commits that introduce lint violations break the build. If this happens, it is the responsibility of the original author
20+
to fix any violations. If you think an exception to a rule should be made for some reason, you should add
21+
an `// eslint-disable` directive to the line above the violating piece of code. This turns off the rule for the
22+
specific occurrence of the issue.
23+
24+
The repo also contains an `eslint-suppressions` file. This is for lint violations that have been introduced with the
25+
addition of new eslint rules (or had been introduced before we started using eslint). This file should only ever
26+
decrease in size, when a legacy violation is fixed. That is, newly introduced lint violations should never be added to the
27+
suppressions file. The only exception to this rule is when a commit introduces a new eslint rule, and you deem that
28+
fixing existing the violations would be too expensive. In this case, running `yarn run lint --fix --suppress-all` will
29+
attempt to autofix violations, and if any violations cannot be fixed, they are added to the suppressions file.
30+
31+
When you fix a legacy violation, it is nice to remove these from the suppressions file by running `yarn run lint:prune`.
32+
We should periodically do this. However, the build is configured not to break when there are outdated suppressions in
33+
the file, so this is not, strictly speaking, necessary after each fixed violation.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
"test-ada-visual": "python3 vrt-in-docker.py ada",
7373
"test-ada-visual-update-baseline": "python3 vrt-in-docker.py ada --update-baselines",
7474
"lint": "eslint -c eslint.config.mjs src/",
75-
"lint:ci": "CI=true yarn run lint --max-warnings=0",
75+
"lint:ci": "CI=true yarn run lint --max-warnings=0 --pass-on-unpruned-suppressions",
76+
"lint:prune": "CI=true yarn run lint --prune-suppressions",
7677
"build-stats-phy": "webpack --env prod --config config/webpack.config.physics.js --profile --json > bundle-stats-phy.json",
7778
"analyse-bundle-phy": "webpack-bundle-analyzer bundle-stats-phy.json build-phy",
7879
"build-stats-ada": "webpack --env prod --config config/webpack.config.ada.js --profile --json > bundle-stats-ada.json",

src/app/components/elements/list-groups/AbstractListViewItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ export const AbstractListViewItem = ({title, icon, subject, subtitle, breadcrumb
174174
const isDisabled = state && [AbstractListViewItemState.COMING_SOON, AbstractListViewItemState.DISABLED].includes(state);
175175

176176
fullWidth = fullWidth || below["sm"](deviceSize) || (isItem && !(typedProps.status || typedProps.audienceViews));
177-
const cardBody =
178-
<div className="w-100 d-flex flex-row">
177+
const cardBody = <div className="w-100 d-flex flex-row">
179178
<Col className={classNames("d-flex flex-grow-1", {"mt-3": isCard, "mb-3": isCard && !typedProps.linkTags?.length})}>
180179
<div className="position-relative">
181180
{icon && (

0 commit comments

Comments
 (0)