Skip to content

Commit 1017028

Browse files
committed
feat(config/eslint): add strict React ESLint configuration
1 parent 874fdc0 commit 1017028

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

eslint/react-strict.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../dist/config/eslintrc-react-strict')

src/config/__tests__/__snapshots__/eslintrc.js.snap

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,26 @@ Object {
261261
}
262262
`;
263263
264+
exports[`Strict ESLint React configuration 1`] = `
265+
Object {
266+
"rules": Object {
267+
"react/function-component-definition": Array [
268+
"error",
269+
Object {
270+
"namedComponents": "arrow-function",
271+
"unnamedComponents": "arrow-function",
272+
},
273+
],
274+
"react/jsx-sort-props": Array [
275+
"error",
276+
Object {
277+
"reservedFirst": false,
278+
},
279+
],
280+
},
281+
}
282+
`;
283+
264284
exports[`Strict ESLint configuration 1`] = `
265285
Object {
266286
"rules": Object {

src/config/__tests__/eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import eslint from '../eslintrc'
22
import eslintStrict from '../eslintrc-strict'
33
import eslintReact from '../eslintrc-react'
4+
import eslintReactStrict from '../eslintrc-react-strict'
45

56
import {
67
winPathSerializer,
@@ -21,3 +22,7 @@ test('Strict ESLint configuration', () => {
2122
test('ESLint React configuration', () => {
2223
expect(eslintReact).toMatchSnapshot()
2324
})
25+
26+
test('Strict ESLint React configuration', () => {
27+
expect(eslintReactStrict).toMatchSnapshot()
28+
})

src/config/eslintrc-react-strict.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
rules: {
3+
'react/jsx-sort-props': ['error', {reservedFirst: false}],
4+
'react/function-component-definition': [
5+
'error',
6+
{
7+
namedComponents: 'arrow-function',
8+
unnamedComponents: 'arrow-function',
9+
},
10+
],
11+
},
12+
}

0 commit comments

Comments
 (0)