Skip to content

fix: eslint config - #123

Merged
ahmaxed merged 1 commit into
freeCodeCamp:masterfrom
huyenltnguyen:fix/eslint-config
Jan 23, 2021
Merged

ahmaxed merged 1 commit into
freeCodeCamp:masterfrom
huyenltnguyen:fix/eslint-config

Conversation

@huyenltnguyen

Copy link
Copy Markdown
Member

No description provided.

Comment thread .eslintrc
"browser": true,
"mocha": true,
"node": true
"es6": true,

@huyenltnguyen huyenltnguyen Jan 17, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ecmaVersion seems to be a valid property, according to ESLint doc, but I think it's only available on newer eslint version (v7), while ours is still on v5.

Comment thread .eslintrc
"mocha": true,
"node": true
},
"parser": "babel-eslint",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the missing part that causes eslint not working.

Comment thread .eslintrc-base.json
"jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
"jsx-a11y/no-noninteractive-tabindex": "error",
"jsx-a11y/no-onchange": "error",
"jsx-a11y/no-onchange": 0,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once I got eslint to work, there is an error in the Footer component, where we have an onChange event in <select> element.

This rule is outdated as it was based on the behaviors of old browsers. The rule will be deprecated in the next release of jsx-a11y: jsx-eslint/eslint-plugin-jsx-a11y#398 (comment)

I disabled the rule to prevent false positive error.

Comment thread package.json
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"lint:fix": "eslint --fix --ext .js ."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a script here to fix lint problems, but I could add a pre-commit hook here if we deem it necessary.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a nice to have.

@ahmaxed
ahmaxed merged commit ecd8e83 into freeCodeCamp:master Jan 23, 2021
@huyenltnguyen
huyenltnguyen deleted the fix/eslint-config branch January 30, 2021 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants