Skip to content

Commit

Permalink
fix: prevent automatic find-up of eslint, use local config in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
amcgee committed Jan 13, 2021
1 parent 81b2a61 commit 6fab73a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 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.

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

const eslintRunningLocally = process.cwd() === __dirname

const delegateEslintConfig = path.resolve(__dirname, '../.eslintrc.js') // This should only exist when in development! However it will pick up .d2/.eslintrc.s in an app, but that shouldn't exist
const shouldDelegate =
!eslintRunningLocally && fs.existsSync(delegateEslintConfig)

const extendsList = shouldDelegate
? [delegateEslintConfig, 'react-app']
: 'react-app'
module.exports = {
ignorePatterns: shouldDelegate ? [] : ['src/D2App/*'],
extends: extendsList,
}

0 comments on commit 6fab73a

Please sign in to comment.