Skip to content

Commit f164ef7

Browse files
alexeyrJudahmeek
authored andcommitted
Enable ESLint on generator templates
1 parent 476cd23 commit f164ef7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

eslint.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const compat = new FlatCompat({
1313

1414
const config = tsEslint.config([
1515
globalIgnores([
16-
'lib/generators/react_on_rails/templates',
1716
// compiled code
1817
'node_package/lib/',
1918
// used for tests only
@@ -123,6 +122,15 @@ const config = tsEslint.config([
123122
'jsx-a11y/anchor-is-valid': 'off',
124123
},
125124
},
125+
{
126+
files: ['lib/generators/react_on_rails/templates/**/*'],
127+
rules: {
128+
// It doesn't use package.json from the template
129+
'import/no-unresolved': 'off',
130+
// We have `const [name, setName] = useState(props.name)` so can't just destructure props
131+
'react/destructuring-assignment': 'off',
132+
},
133+
},
126134
{
127135
files: ['**/*.ts', '**/*.tsx'],
128136

lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/reducers/helloWorldReducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { combineReducers } from 'redux';
22
import { HELLO_WORLD_NAME_UPDATE } from '../constants/helloWorldConstants';
33

4-
const name = (state = '', action) => {
4+
const name = (state = '', action = {}) => {
55
switch (action.type) {
66
case HELLO_WORLD_NAME_UPDATE:
77
return action.text;

0 commit comments

Comments
 (0)