Skip to content

Commit

Permalink
feat: allow eslint-react config to be bundled
Browse files Browse the repository at this point in the history
  • Loading branch information
varl committed Nov 22, 2019
1 parent 4d1a4eb commit ab63b9b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const { config } = require('@dhis2/cli-style')

module.exports = {
parser: 'babel-eslint',

extends: [config.eslint, 'plugin:react/recommended'],
extends: ['./eslint.config.js', 'plugin:react/recommended'],

settings: {
react: {
Expand All @@ -20,5 +18,6 @@ module.exports = {
callbacksLast: true,
},
],
'react/no-unused-prop-types': 'error',
},
}
5 changes: 5 additions & 0 deletions config/js/eslint-react.local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { config } = require('@dhis2/cli-style')

module.exports = {
extends: [config.eslintReact],
}
5 changes: 5 additions & 0 deletions src/utils/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path')
const {
BROWSERSLIST_CONFIG,
ESLINT_CONFIG,
ESLINT_REACT_CONFIG,
HUSKY_CONFIG,
PRETTIER_CONFIG,
STALE_CONFIG,
Expand Down Expand Up @@ -290,6 +291,10 @@ const bundledConfigPaths = () => {
case 'eslint':
config.eslint = ESLINT_CONFIG
break
case 'eslint-react':
config.eslintReact = ESLINT_REACT_CONFIG
config['eslint-react'] = ESLINT_REACT_CONFIG
break
case 'husky':
config.husky = HUSKY_CONFIG
break
Expand Down
12 changes: 11 additions & 1 deletion src/utils/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const CONFIG_ROOT = path.join(__dirname, '..', '..')
const CONFIG_DIR = path.join(CONFIG_ROOT, 'config')

const ESLINT_CONFIG = path.join(CONFIG_DIR, 'js', 'eslint.config.js')
const ESLINT_REACT_CONFIG = path.join(
CONFIG_DIR,
'js',
'eslint-react.config.js'
)
const PRETTIER_CONFIG = path.join(CONFIG_DIR, 'js', 'prettier.config.js')

const BROWSERSLIST_CONFIG = path.join(
Expand All @@ -27,7 +32,11 @@ const LOCAL_HUSKY_FRONTEND_CONFIG = path.join(
const LOCAL_HUSKY_CONFIG = path.join(CONFIG_DIR, 'husky.local.js')

// local configuration files for repositories
const LOCAL_ESLINT_REACT_CONFIG = path.join(CONFIG_DIR, 'js', 'eslint.react.js')
const LOCAL_ESLINT_REACT_CONFIG = path.join(
CONFIG_DIR,
'js',
'eslint-react.local.js'
)
const LOCAL_ESLINT_CONFIG = path.join(CONFIG_DIR, 'js', 'eslint.local.js')

const LOCAL_PRETTIER_CONFIG = path.join(CONFIG_DIR, 'js', 'prettier.local.js')
Expand All @@ -41,6 +50,7 @@ module.exports = {
DEPENDABOT_CONFIG,
EDITORCONFIG_CONFIG,
ESLINT_CONFIG,
ESLINT_REACT_CONFIG,
LOCAL_ESLINT_CONFIG,
LOCAL_ESLINT_REACT_CONFIG,
LOCAL_PRETTIER_CONFIG,
Expand Down

0 comments on commit ab63b9b

Please sign in to comment.