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

Clean up linter scripts and docs #6457

Merged
merged 3 commits into from
Feb 9, 2024
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
4 changes: 1 addition & 3 deletions knowledge_base/Linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@

All linting commands should be run from root.

- `yarn lint`
- Lints new code changes that have yet to be committed.
- `yarn lint-all`
- Lints all code (regardless of changes)
- `yarn lint-branch`
- Lints all changes made in a branch (used in CI). This is the command most people will want to use.
- Lints all changes made in a branch (used in CI).

## Configuration

Expand Down
19 changes: 3 additions & 16 deletions knowledge_base/Package-Scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ If you add a script to the `package.json` file, please add documentation for it
- [cosmos:stop](#cosmosstop)
- [Linting & Formatting](#linting--formatting)
- [format](#format)
- [lint](#lint)
- [lint-all](#lint-all)
- [lint-branch](#lint-branch)
- [lint-branch-warnings](#lint-branch-warnings)
Expand Down Expand Up @@ -241,29 +240,17 @@ Definition: `prettier --ignore-path ../../.prettierignore --config ../../.pretti

Description: Autoformats files using config `prettierrc.json` config.

### lint

Definition: `./scripts/lint-new-work.sh`

Description: Lints new work, according to script file `lint-new-work.sh`.

Considerations: Problematically, only checks .ts files. Name is misleading. Redundancy with [lint-branch](#lint-branch) script. **Flagged for possible removal.**

### lint-all

Definition: `eslint client/\\**/*.{ts,tsx} server/\\**/*.ts`

Description: Only lints changed files on current branch.

Considerations: May be more clearly renamed "lint-changes".
Description: Lints all TypeScript files within the `client` and `server` directories.

### lint-branch

Definition: `./scripts/lint-branch.sh`

Description: Redundant with [lint](#lint) script, which uses 'git status' instead of 'git diff' but is build toward the same action (isolating changed files for linting).

Considerations: Recommend eliminating either [lint](#lint) or [lint-branch](#lint-branch) scripts. Problematically, lint-branch only checks .ts files. **Flagged for possible removal.**
Description: Used in the CI. Lints updated files on the current branch.

### lint-branch-warnings

Expand All @@ -277,7 +264,7 @@ Definition: `stylelint client/styles/*`

Description: Lints SCSS files.

Considerations: Why lint styles separately? Why not just include `.scss` file extension in [lint](#lint) and [lint-all](#lint-all) scripts (which currently only target `.ts` files)? **Flagged for possible removal.**
Considerations: Why lint styles separately? Why not just include `.scss` file extension in [lint-branch](#lint-branch) and [lint-all](#lint-all) scripts (which currently only target `.ts` files)? **Flagged for possible removal.**

## Other services

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"format-check": "prettier --check .",
"heroku-postbuild": "chmod u+x scripts/heroku-build.sh && ./scripts/heroku-build.sh",
"heroku-prebuild": "yarn global add node-gyp",
"lint": "./scripts/lint-new-work.sh",
"lint-all": "NODE_OPTIONS=\"--max-old-space-size=4096\" eslint './packages/**/*.{ts,tsx}'",
"lint-branch": "./scripts/lint-branch.sh",
"lint-branch-warnings": "FAIL_WARNINGS=1 ./scripts/lint-branch.sh",
Expand Down
1 change: 0 additions & 1 deletion packages/commonwealth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"format": "prettier --ignore-path ../../.prettierignore --config ../../.prettierrc.json --write .",
"heroku-postbuild": "NODE_OPTIONS=--max-old-space-size=$(../../scripts/get-max-old-space-size.sh) webpack --config webpack/webpack.prod.config.js --progress && yarn build-consumer",
"integration-test": "nyc ts-mocha -r tsconfig-paths/register './test/integration/**/*.spec.ts'",
"lint": "./scripts/lint-new-work.sh",
"lint-all": "eslint client/\\**/*.{ts,tsx} server/\\**/*.ts",
"lint-branch": "./scripts/lint-branch.sh",
"listen": "RUN_AS_LISTENER=true ts-node -r tsconfig-paths/register server.ts",
Expand Down
9 changes: 0 additions & 9 deletions scripts/lint-new-work.sh

This file was deleted.

Loading