From 567fb10014fb0abbc0f993f1138657b111658774 Mon Sep 17 00:00:00 2001 From: Bryan Ho Date: Mon, 25 Sep 2023 17:54:17 -0700 Subject: [PATCH] 76 Add formatter for JavaScript/TypeScript files (#79) * add lint config * removed uitests from ts include * run eslint commands * strict null checks false * removed edits to tsconfig --- .eslintrc.js | 28 ++++++++++++++++++++++++++++ README.md | 4 +++- package.json | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..8168cae4 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,28 @@ +module.exports = { + "env": { + "browser": true, + "es2021": true + }, + "extends": "standard-with-typescript", + "overrides": [ + { + "env": { + "node": true + }, + "files": [ + ".eslintrc.{js,cjs}", + "" + ], + "parserOptions": { + "sourceType": "script", + "project": "./tsconfig.json", + } + } + ], + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module", + }, + "rules": { + } +} diff --git a/README.md b/README.md index 2612237f..fb1853f6 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,9 @@ pip install -r requirements.dev.txt jlpm install ``` -Note: `pkgmt format` can be used to format and lint before committing code. +Note: `pkgmt format` can be used to format and lint Python files before committing code. +To format JavaScript and TypeScript files, use `yarn run eslint`. To lint without formatting, +use `yarn run eslint:check` ```bash # Note: this command will take some time the first time as it has to install diff --git a/package.json b/package.json index 87713503..1ea9de0c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "clean:labextension": "rimraf jupysql_plugin/labextension jupysql_plugin/_version.py", "clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache", "eslint": "jlpm eslint:check --fix", - "eslint:check": "eslint . --cache --ext .ts,.tsx", + "eslint:check": "eslint src/ --cache --ext .ts,.tsx", "install:extension": "jlpm build", "lint": "jlpm stylelint && jlpm prettier && jlpm eslint", "lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",