The subject says it mostly already; my default TS + TFJS setup seems to mangle existing style, e.g. see:
tensorflow:master
β iislucas:iislucas-prod-grad
opened 08:34PM - 11 Mar 22 UTC
Initial implementation of gradients for `prod` operator:
Fixes: https://githu⦠b.com/tensorflow/tfjs/issues/2587
Tested locally with:
```
$ yarn run tslint -p tsconfig_tslint.json
$ cd tfjs-core
$ yarn run bazel test --test_output=streamed :tfjs-core_test :test_snippets_test :tfjs-core_node_test :tfjs-core_async_backends_test src:worker_node_test src:worker_test --//:grep=prod
```
---
This change isβ[<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/tensorflow/tfjs/6216)
Curious what others do to get vscode to fix style instead of breaking it
Bhack
March 30, 2022, 10:46pm
2
It is executed on save but non integrated in the IDE:
"[javascript]": {
"editor.formatOnSave": true
},
"[cpp]": {
"editor.formatOnSave": true
},
"emeraldwalk.runonsave": {
"commands": [
{
"match": "(BUILD|.*bzl)",
"cmd": "yarn bazel:format && yarn bazel:lint"
}
]
},
"editor.defaultFormatter": "xaver.clang-format",
"editor.rulers": [80],
"clang-format.style": "Google",
"files.insertFinalNewline": true,
"editor.detectIndentation": false,
"editor.wrappingIndent": "none",
"typescript.tsdk": "node_modules/typescript/lib",
I suppose that you can try to configure Eslint extension with the same behavior as the linting steps:
"rimraf": "~2.6.2",
"rollup": "^3.20.2",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-visualizer": "~5.9.0",
"seedrandom": "^3.0.5",
"semver": "^7.5.2",
"shelljs": "~0.8.5",
"string_decoder": "^1.3.0",
"terser": "^5.14.2",
"ts-morph": "^11.0.3",
"ts-node": "~8.8.2",
"tslib": "^2.4.0",
"tslint": "^6.1.3",
"tslint-no-circular-imports": "~0.7.0",
"typescript": "5.0.4",
"verdaccio": "^5.9.0"
},
"scripts": {
"lint": "tslint -p tsconfig_tslint.json",
"test": "bazel test //:tests",
Probably it could be interesting to contribute this configuration on the repository.
1 Like
yes, it would make it easier to contribute; using different defaults will cause all sorts of formatting changes by accident and break lint style. Adding it and documenting in in the how to contribute docs would be great.