Skip to content

Commit f3fdc6c

Browse files
committed
fix(react): fix react jsx rules
1 parent 26cf579 commit f3fdc6c

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "eslint-config-bryanberger",
33
"description": "My personal ESLint config",
4-
"version": "1.0.3",
4+
"version": "1.0.4",
55
"license": "MIT",
66
"main": "index.js",
77
"homepage": "https://github.com/BryanBerger98/eslint-config-bryanberger",

react.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ module.exports = {
106106

107107
// Validate props indentation in JSX
108108
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
109-
'react/jsx-indent-props': [ 'error', 2 ],
109+
'react/jsx-indent-props': [
110+
'warn',
111+
{
112+
indentMode: 'tab',
113+
ignoreTernaryOperator: true,
114+
},
115+
],
110116

111117
// Validate JSX has key prop when in array or iterator
112118
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
@@ -247,7 +253,7 @@ module.exports = {
247253

248254
// Prevent missing React when using JSX
249255
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
250-
'react/react-in-jsx-scope': 'error',
256+
'react/react-in-jsx-scope': 'off',
251257

252258
// Require render() methods to return something
253259
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
@@ -331,7 +337,14 @@ module.exports = {
331337

332338
// Enforce JSX indentation
333339
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
334-
'react/jsx-indent': [ 'error', 2 ],
340+
'react/jsx-indent': [
341+
'warn',
342+
'tab',
343+
{
344+
indentLogicalExpressions: true,
345+
checkAttributes: true,
346+
},
347+
],
335348

336349
// Disallow target="_blank" on links
337350
// https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
@@ -540,10 +553,13 @@ module.exports = {
540553

541554
// Enforce a specific function type for function components
542555
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
543-
'react/function-component-definition': [ 'error', {
544-
namedComponents: [ 'function-declaration', 'function-expression' ],
545-
unnamedComponents: 'function-expression',
546-
} ],
556+
'react/function-component-definition': [
557+
'warn',
558+
{
559+
namedComponents: 'arrow-function',
560+
unamedComponents: 'arrow-function',
561+
},
562+
],
547563

548564
// Enforce a new line after jsx elements and expressions
549565
// https://github.com/jsx-eslint/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-newline.md

0 commit comments

Comments
 (0)