Wk-notes-11-05-babel-loader-eslint
Key take aways
npm package
cli(npx) run from "bin" config inpackage.json, it's defaulted as:"bin": { "widget-cli": "./bin/widget-cli.js" }Upgrade package helps (eslint)
Useful commands
There is an issue about the difference between cli eslint and vscode eslint extension.
Use local eslintrc This is what vscode eslint extension calls:
npx eslint -c ./.eslintrc ./src/Components/Button/index.js > local-lint-config.json
Print the complete eslint config:
npx eslint --print-config ./src/./src/Components/Button/index.js > local-lint-config.json
Use widget-cli eslint:
npx widget-cli eslint ...
What babel loader config/rc file eslint vscode extension is using to compile and lint?
"parserOptions":{
"babelOptions":{
"configFile": "PATH_TO_CONFIG"
}
}babel.config.js and .babelrc.js under root dir will be picked as default
Eslint cli
eslint have a CliEngine which loads the cli options. --print-config will trigger engine.getConfigForFile(PATH_TO_SINGLE_FILE) to load the config for single file. Cos the config can vary for different type of files, you need to specify single file here.
Last updated
Was this helpful?