I use webpack plugin:
new webpack.DefinePlugin({
PUBLIC_KEY:'\'XXX\'',
CLIENT_ID: '\'XXXX\''
})
tgc.init({
publicKey: PUBLIC_KEY,
clientId: CLIENT_ID
});
I use eslint and use Disallow Undeclared Variables (no-undef)
rule, so when I write
tgc.init({
publicKey: PUBLIC_KEY,
clientId: CLIENT_ID
});
I get errors:
'PUBLIC_KEY' is not defined
'CLIENT_ID' is not edfined
How to avoid it? I don't want to disable this rule (with disabled rule all works fine)
Add:
"globals": {
"PUBLIC_KEY": true,
"CLIENT_ID": true,
}
to your eslint.rc
-file.
or you can do the same in your webpack config -file as an inline comment like:
/* global PUBLIC_KEY, CLIENT_ID */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With