eslint
--fix
https://eslint.org/docs/user-guide/command-line-interface#fixing-problems
--ignore-pattern
https://eslint.org/docs/user-guide/command-line-interface#ignoring-files
eslint object trailing comma
[eslint] Unexpected trailing comma.
https://eslint.org/docs/rules/comma-style
https://eslint.org/docs/rules/comma-dangle
https://eslint.org/docs/rules/object-curly-newline
{
// "comma-dangle": ["error", {
// "objects": "never",
// }],
// "comma-style": ["none", "last", {"exceptions": { "ArrayExpression": true, "ObjectExpression": true }}],
'comma-dangle': [ERROR, 'always-multiline'],
}
https://github.com/facebook/react/blob/master/.eslintrc.js
{
"comma-dangle": ["error", "never"],
// or
"comma-dangle": ["error", {
"arrays": "never",
"objects": "never",
"imports": "never",
"exports": "never",
"functions": "ignore"
}]
}
https://eslint.org/docs/rules/comma-dangle#always
{
"comma-dangle": ["error", "always"],
// or
"comma-dangle": ["error", {
"arrays": "always",
"objects": "always-multiline",
"imports": "never",
"exports": "never",
"functions": "ignore"
}]
}
https://eslint.org/docs/rules/
eslint ignore
/* eslint-disable no-unused-vars */
// eslint-disable-next-line no-unused-vars
/* eslint-enable no-unused-vars */
https://eslint.org/docs/2.13.1/user-guide/configuring
https://eslint.org/docs/user-guide/command-line-interface
jest & eslint ignore
/* eslint-disable no-unused-vars, no-undef */
// eslint-disable-next-line
test('sum(1, 2) should return 3', () => {
/* eslint-enable no-unused-vars, no-undef */
expect(sum(1, 2)).toBe(3);
});
https://eslint.org/docs/rules/no-undef
https://eslint.org/docs/rules/no-unused-vars
https://stackoverflow.com/questions/38757069/how-to-disable-eslint-in-vue-cli
https://github.com/vuejs-templates/webpack/issues/73
https://flaviocopes.com/how-to-disable-eslint-rule/
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!