Skip to content

Commit

Permalink
fix: disable eslint for all installed shell files, lint in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mediremi authored Jan 13, 2021
2 parents 0145e79 + 3ccdbd0 commit 1933eca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/dhis2-verify-lib.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: 'dhis2: verify (lib)'

on:
push:
branches:
on: push

env:
GIT_AUTHOR_NAME: '@dhis2-bot'
Expand All @@ -12,6 +10,7 @@ env:
NPM_TOKEN: ${{secrets.DHIS2_BOT_NPM_TOKEN}}
GH_TOKEN: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}}
CI: true
D2_VERBOSE: true

jobs:
install:
Expand Down
1 change: 0 additions & 1 deletion shell/.eslintignore

This file was deleted.

17 changes: 11 additions & 6 deletions shell/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
const fs = require('fs'),
path = require('path')
const fs = require('fs')
const path = require('path')

const customConfigFile = path.resolve('../../.eslintrc.js')
const hasCustomConfig = fs.existsSync(customConfigFile)
const eslintRunningLocally = process.cwd() === __dirname

const extendsArray = hasCustomConfig ? [customConfigFile] : ['react-app']
const delegateEslintConfig = path.resolve(__dirname, '../.eslintrc.js') // This should only exist when in development!
const shouldDelegate =
!eslintRunningLocally && fs.existsSync(delegateEslintConfig)

const extendsList = shouldDelegate
? [delegateEslintConfig, 'react-app']
: 'react-app'
module.exports = {
extends: extendsArray,
ignorePatterns: shouldDelegate ? [] : ['src/D2App/*'],
extends: extendsList,
}
4 changes: 3 additions & 1 deletion shell/src/D2App/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react'

export default () => <h2>PLACEHOLDER</h2>
const PlaceholderApp = () => <h2>PLACEHOLDER</h2>

export default PlaceholderApp

0 comments on commit 1933eca

Please sign in to comment.