Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eslint config] set namedComponents option to match style guide #2501

Merged
merged 3 commits into from Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/eslint-config-airbnb-base/rules/best-practices.js
Expand Up @@ -376,6 +376,11 @@ module.exports = {
// https://eslint.org/docs/rules/prefer-named-capture-group
'prefer-named-capture-group': 'off',

// Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
// https://eslint.org/docs/rules/prefer-object-has-own
// TODO: semver-major: enable thus rule, once eslint v8.5.0 is required
'prefer-object-has-own': 'off',

// https://eslint.org/docs/rules/prefer-regex-literals
'prefer-regex-literals': ['error', {
disallowRedundantWrapping: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-airbnb/package.json
Expand Up @@ -79,7 +79,7 @@
"eslint-find-rules": "^4.0.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"in-publish": "^2.0.1",
"react": ">= 0.13.0",
Expand All @@ -90,7 +90,7 @@
"eslint": "^7.32.0 || ^8.2.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0"
},
"engines": {
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-config-airbnb/rules/react.js
Expand Up @@ -524,9 +524,8 @@ module.exports = {

// Enforce a specific function type for function components
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
// TODO: investigate if setting namedComponents to expression vs declaration is problematic
'react/function-component-definition': ['error', {
namedComponents: 'function-expression',
namedComponents: ['function-declaration', 'function-expression'],
unnamedComponents: 'function-expression',
}],

Expand Down