Suppressing Specific JSUnresolvedVariable Warnings
How can I cleanly suppress the warnings on unresolved variable for Node environment variables? I don't want to have to keep putting this all over my code, that's just code smell and a terrible way to go about that IMO:
// noinspection JSUnresolvedVariable
So how can I tell Webstorm to ignore all Node environment variables?
Here's some of my code using them:
import app from './app';
require('dotenv').config();
const { env } = process;
// noinspection JSUnresolvedVariable
app.listen(env.PROD_SERVICE_PORT, err => {
// noinspection JSUnresolvedVariable
console.log(`Koa is listening on port ${env.PROD_SERVICE_PORT}`);
if (err) {
console.log('server startup error');
console.log(err);
}
});
root/.env
MYSQL_HOST = 'us-cdbr-iron-east'
MYSQL_PORT = 3306
MYSQL_USERNAME = 'b305bc'
MYSQL_PASSWORD = '5e58a4'
MYSQL_DATABASE = 'heroku_6f'
PROD_SERVICE_PORT = 8000
Please sign in to leave a comment.
You can try defining your env object using JSDoc in your file, like: