-
Notifications
You must be signed in to change notification settings - Fork 13
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
Update ts configs, add diff-based linter. #995
Conversation
f99a5ed
to
4a31dff
Compare
"protobufjs-cli": "^1.1.2", | ||
"style-loader": "^3.3.3", | ||
"ts-jest": "^29.1.1", | ||
"ts-loader": "^9.4.4", | ||
"tsx": "4.7.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsx
is superior over ts-node
. I spend a lot of time fighting ts-node
when I tried to run esm+commonjs packages in the same app. tsx
just works.
@@ -2,32 +2,28 @@ | |||
// This Source Code Form is subject to the terms of the Mozilla Public | |||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | |||
// You can obtain one at https://mozilla.org/MPL/2.0/. | |||
|
|||
module.exports = { | |||
settings: { | |||
react: { | |||
version: 'detect', | |||
}, | |||
}, | |||
extends: ['standard-with-typescript', 'prettier', 'plugin:react/recommended'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier
stays here to disable eslint
rules that prettier
covers.
"../node_modules/@types", | ||
], | ||
"typeRoots": ["../node_modules/@types"], | ||
"jsx": "react-jsx", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It src/web
specific thing, isn't it? We shouldn't use React outside web.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is added so tsc --noEmit -p src
can compile all sources in src/
without issues.
This config parameter is a no-op for other projects that don't use jsx/tsx
files.
7571421
to
69c9b78
Compare
69c9b78
to
2bd93a5
Compare
package.json
Outdated
"serve:dev": "webpack serve -c src/web/webpack.config.js --hot --mode=development", | ||
"test": "jest --config=src/jest.config.js", | ||
"tracker": "node src/finch_tracker/build/finch_tracker/main.js", | ||
"typecheck": "tsc --noEmit" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be run as a blocker for merging? Otherwise there is no type-checking for the node code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good solution, as long as npm run typecheck
is used as a workflow to prevent merging code that fails to compile.
[puLL-Merge] - brave/brave-variations@995 DescriptionThis PR includes various build system and code style improvements. It adds new npm scripts for linting, cleaning, and type checking. It also integrates Prettier for consistent code formatting across the project. The ESLint configuration has been updated and a new lint-staged setup ensures only relevant files are linted on commit. ChangesChanges
Security HotspotsNo major security hotspots identified in this change. The updates are mostly related to the development workflow and code styling. A few minor notes:
|
Sec-review to add
tsx
https://github.com/brave/reviews/issues/1575Changes in this PR:
npm run lint
.lint-staged
integration to support diff linting with arbitrary executables. This will allow us to perform full study validation as a part of a singlenpm run lint
call.lint-staged
can also be integrated intopre-commit
orpre-push
git hooks, but after some experiments I decided to postpone this integration.tsconfig
andeslint
configs to run type checks onsrc/
.Related issue brave/brave-browser#33654