Using eslint-config-freecodecamp for fcc projects

Using eslint-config-freecodecamp for fcc projects
0.0 0

#1

I have fcc running locally and linting works fine in Atom editor.
I thought I would add linting into my projects to get used to fcc style.
I’m using this fullstack (tutorial) setup for fcc backend dev projects with following structure:

/...
/client/src/App.js
/server/index.js
/package.json
/...

I copied .eslintrc and .eslintignore from fcc local and installed eslint and eslint-config-freecodecamp (locally) to a test project with above structure.

I get the following error for (client) react app.js and (server) index.js:
Error while running ESLint: ImportDeclaration should appear when the mode is ES6 and in the module context.

Top line of files where error appears:
app.js: import React from 'react';
index.js:

if (process.env.NODE_ENV !== 'production') {
  require( 'dotenv').config();
}

Desperation lead me to try copying the .babelrc and .jshintrc files but no luck.

any suggestions?


#2

If you are following the guide exactly then I suspect the problem is potentially because create-react-app works a little differently because everything it’s supposed to be opinionated.

This link will likely solve your problems—I’ve only dabbled with it enough to get the default linting rules in CRA working in Atom, but they do mention that you can override CRA settings by editing .eslintrc.

I hope that helps. :slight_smile:


#3

yes the default works a treat, but I’m specifically trying to get freecodecamp working. thanx for taking the time to respond dude, appreciate it :slight_smile: