New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eslint plugin react hooks #67
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
package-lock.json | ||
yarn.lock | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import { string } from 'prop-types' | ||
|
||
const Component = ({ someProp }) => { | ||
const [state, setState] = useState() | ||
|
||
useEffect(() => { | ||
if (someProp) { | ||
setState(someProp) | ||
} | ||
}, [someProp]) | ||
|
||
return <h1>{state}</h1> | ||
} | ||
|
||
Component.propTypes = { | ||
someProp: string | ||
} | ||
|
||
export default Component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
const eslint = require('eslint') | ||
const { ESLint } = require('eslint') | ||
const test = require('tape') | ||
const config = require('../eslintrc.json') | ||
const path = require('path') | ||
|
||
test('load config in eslint to validate all rule syntax is correct', function (t) { | ||
const CLIEngine = eslint.CLIEngine | ||
|
||
const cli = new CLIEngine({ | ||
test('load config in eslint to validate all rule syntax is correct', async function (t) { | ||
const eslint = new ESLint({ | ||
useEslintrc: false, | ||
configFile: 'eslintrc.json' | ||
baseConfig: config | ||
}) | ||
const results = await eslint.lintFiles(path.resolve(__dirname, '../TestComponent.jsx')) | ||
|
||
const code = 'var foo = 1\nvar bar = function () {}\nbar(foo)\n' | ||
|
||
t.equal(cli.executeOnText(code).errorCount, 0) | ||
t.equal(results[0].errorCount, 0) | ||
t.end() | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding lock files to the gitignore I think it's better to add an
.npmrc
file withpackage-lock=false
in it. Otherwise people will be using a lock-file locally, it just won't be synchronised...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you, seems the owner of this PR doesn't know about programming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a better solution would be to agree to use just one package manager to develop this and add it to a
contributions
orrequirements
section of the readme.P.D: this PR just turned 1 year old 🥳