Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Added "strict" to project. #239

Open
wants to merge 239 commits into
base: master
Choose a base branch
from
Open

Conversation

CarlosSolrac
Copy link
Contributor

@CarlosSolrac CarlosSolrac commented Oct 13, 2019

Instead of using process.env.VARIABLE, export uppercase variables.
process.env.VARIABLE is interpreted as "string | undefined" causing compiler errors.

.env.example

  • change the SESSION_SECRET to pass "code spell checker"
  • add NODE_ENV
  • add SENDGRID
  • add TZ to set timezone to UTC
  • change MONGODB_URI to MONGODB_URI_PROD to distinguish it from MONGODB_URI_LOCAL

tsconfig.json

  • add strict to the entire project

src/app.ts

  • specify param types
  • check for possible undefined

src/config/passport.ts

  • stop using process.env
  • check for possible undefined
  • Set type for user parameter
  • Remove "any" from serializeUser definition

src/controller/api.ts

  • test for nullable token

src/controller/contact.ts

  • stop using process.env

src/controller/user.ts

  • stop using process.env
  • check for possible undefined

src/model/user.ts

  • fix bcrypt params
  • fix comparePasswordFunction params

src/util/logger.ts

  • stop using process.env

src/util/secrets.ts

  • stop using process.env

Bowden Kelly and others added 30 commits May 9, 2017 13:28
Update references from bowdenk7 repo to Microsoft repo
added package-lock for npm5 and fixed bug with flash messages
Added `build` `preLaunchTask` for debug configuration
Removed duplication in npm scripts `serve` and `watch`
…MaxOptions'.

fix err TypeScript-Node-Starter/src/controllers/api.ts[6, 9]: missing whitespace, 8 files
fix bugs of issue 15
fit  bugs of issue 15 and some other bugs caused by tslint
port changes from PR microsoft#11 and update package.lock from latest npm version
dependabot bot and others added 23 commits July 10, 2019 22:59
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.13.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.11...4.17.13)

Signed-off-by: dependabot[bot] <[email protected]>
…rn/lodash-4.17.13

Bump lodash from 4.17.11 to 4.17.13

#dependabot
This removes NPM audit warnings which seems to be raised by the older
version of the lock file.
This one was regenerated with NPM v6.9.0 (Node v10.*)

Thanks!
…lash-types

Simplify augmented module for express-flash
…-nodejs-versions

Specify NodeJS version as strings in Travis configuration
📝 remove reference to legacy file. Closes microsoft#190
This commit rewrites linting support in the project to be based solely
on the ESLint as advised by the TSLint tool authors:
https://medium.com/palantir/tslint-in-2019-1a144c2317a9

The migration is based on default, recommended settings for TypeScript
in ESLint and is expected to be updated in future to better fit project
goals.

All references has been updated and replaced with relevant ESLint
context:

- dependencies migration from TSLint to ESLint
- VSCode configuration changes to support ESLint exension
- VSCode extensions recommendation changes
- `.eslintrc` and `.eslintignore` configuration files added
- all error level problems in the source files are covered by this
  migration

Thanks!
fix lint error
```
PS> npm run lint                                                                                                        
> [email protected] lint C:\Users\JipingWang\source\repos\api
> tsc --noEmit && eslint '*/**/*.{js,ts}' --quiet --fix


Oops! Something went wrong! :(

ESLint: 5.16.0.
No files matching the pattern "'*/**/*.{js,ts}'" were found.
Please check for typing mistakes in the pattern.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] lint: `tsc --noEmit && eslint '*/**/*.{js,ts}' --quiet --fix`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\JipingWang\AppData\Roaming\npm-cache\_logs\2019-07-18T15_26_05_580Z-debug.log
```
…rn/eslint-utils-1.4.2

Bump eslint-utils from 1.4.0 to 1.4.2
Use update indexes access in Mongoose configuration. Fixes microsoft#225
- upgrade to latest packages
- cast `req.user` as `UserDocument`
- update logger to use latest Winston syntax
- disable `no-inferrable-types`, Mongoose use unified topology

Thx to @CarlosSolrac
ESLint, no any, no inferrable types, unused vars - warning

thx to @GrayStrider
Instead of using process.env.VARIABLE, export uppercase variables.
process.env.VARIABLE is interpreted as "string | undefined" causing compiler errors.

.env.example
* change the SESSION_SECRET to pass "code spell checker"
* add NODE_ENV
* add SENDGRID
* add TZ to set timezone to UTC
* change MONGODB_URI to MONGODB_URI_PROD to distinguish it from MONGODB_URI_LOCAL

package.json
* update packages

tsconfig.json
* add strict to the entire project

.vscode/settings.json
* minor formatting changes
* add cSpell section

src/app.ts
* specify param types
* check for possible undefined

src/config/passport.ts
* stop using process.env
* check for possible undefined

src/controller/api.ts
* test for nullable token

src/controller/contact.ts
* stop using process.env

src/controller/user.ts
* stop using process.env
* check for possible undefined

src/model/user.ts
* fix bcrypt params
* fix comparePasswordFunction params

src/util/logger.ts
* stop using process.env

src/util/secrets.ts
* stop using process.env
…e Mac OS

Document use of the home directory on macOS 10.15 and above
Thanks to @memasdeligeorgakis
Copy link
Collaborator

@peterblazejewicz peterblazejewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you redact changes to minimal set required for strity types? (.vscode are not essentials, change current behavior for autofix/autosave, package.json is not essential, etc).
Thanks!

src/controllers/api.ts Outdated Show resolved Hide resolved
src/controllers/api.ts Outdated Show resolved Hide resolved
wildlyinaccurate and others added 4 commits November 1, 2019 20:24
Undo settings.json updates

src/config/passport.ts
* Set type for user parameter
* Remove "any" from serializeUser definition

src/controller/api.ts
* Fix ESLint

src/models/User.ts
* Modify comparePasswordFunction definition
@@ -58,15 +58,15 @@ userSchema.pre("save", function save(next) {
if (!user.isModified("password")) { return next(); }
bcrypt.genSalt(10, (err, salt) => {
if (err) { return next(err); }
bcrypt.hash(user.password, salt, undefined, (err: mongoose.Error, hash) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PR #253 I replaced bcrypt-nodejs (abandoned) to bcrypt. And this code gets cleaned up as well.
I realize the callback () => {} is an ugly hack, but hope it to be temporary and replaced with a simplified promise in PR 253.
#253

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet