Skip to content

Commit

Permalink
fix issues with eslint upgrade
Browse files Browse the repository at this point in the history
I noticed that eslint wasn't working after some of the upgrades. I
suspect that this is due to eslint 6 itself and different ways in which
it tries to access plugins. In particular, it seems to have a big
problem trying to inherit settings from a parent folder where there's
no actual node project (with the modules installed that that parent
config would need).

I wasn't able to find a place that comes right out and said the way
we were doing things was once supported and now isn't, but reading
links like the following:

https://eslint.org/docs/user-guide/migrating-to-6.0.0#-plugins-and-shareable-configs-are-no-longer-affected-by-eslints-location
eslint/eslint#11720

make me wonder if we were relying on accidental behaviour to begin
with. In any event, the extra configuration on .vscode's eslint plugin
plus moving to specific .eslintrc.js files for both the client and the
server causes eslint to again operate properly. Given the fuzziness
around the behaviour we were exploiting, it seems better to do this
small amount of duplication rather than roll back the package and
avoid the inevitable for a while longer.
  • Loading branch information
agentdave committed Sep 6, 2019
1 parent 51747e0 commit f3dc326
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
// personal overrides in the User Settings area.

{
"editor.tabSize": 2
"editor.tabSize": 2,
"eslint.enable": true,
"eslint.workingDirectories": [
{ "directory": "./client", "changeProcessCWD": true },
{ "directory": "./server", "changeProcessCWD": true }
],
}
12 changes: 11 additions & 1 deletion client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
// Specific linting for the client-side code

module.exports = {
'extends': 'airbnb',
'parser': 'babel-eslint',
'env': {
'browser': true
'jest': true,
'browser': true,
},
'rules': {
'comma-dangle': 'off',
'semi': 'off',
'no-underscore-dangle': 'off',
'react/jsx-filename-extension': [1, { 'extensions': ['.js', '.jsx'] }],
'no-cond-assign': [2, 'except-parens'],
'no-else-return': ['error', { 'allowElseIf': true }]
}
}
File renamed without changes.

0 comments on commit f3dc326

Please sign in to comment.