-
Notifications
You must be signed in to change notification settings - Fork 45
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
Issue #72 -- Add a Linter #83
Closed
Closed
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
077573e
Adding the eslint configurations
reficul31 11a8c52
Cleaning the linted code
reficul31 b4efbe9
Adding the script commands
reficul31 be72d9b
Adding the initial configuration of editor config
reficul31 ebf0fbf
Changing the configurations
reficul31 9365acb
Refactoring the code according to the rule changes
reficul31 654c1e9
Cleaning the code for the async await commit
reficul31 59be096
Define eslint config as JSON
Treora b29a6c9
Set eslint env: webextensions
Treora 9a6b429
Add eslint-plugin-import.
Treora 7388a7d
Fix missing/unused imports
Treora 982ebdf
rename npm script fix -> lint-fix
Treora 6063832
fix capital letter constructor
Treora aa35410
Fix bug in webextensionRPC
Treora 0efdf85
Tell eslint to check .jsx files
Treora 37f8692
Add linter config for react/jsx
Treora 0f9a47a
Fix some react/jsx complaints
Treora c20f2d3
Fix == / === complaints
Treora 0e7c867
Don't complain about using console
Treora 9d850c2
Correct jsx config
Treora 55faca4
Merge pull request #1 from WebMemex/eslint
reficul31 6d35fcb
Removing the react/proptypes lint
reficul31 ba2860f
Removing the max_line_lenth and fixing a linting error
reficul31 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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,33 @@ | ||
# https://editorconfig.org | ||
# Editor Config for WebMemex | ||
# Download an extension for editor config to allow your IDE | ||
# to follow the rules of the project | ||
|
||
# Used to indicate the file is in root of the project | ||
root = true | ||
|
||
# Styling applicable to all forms of files | ||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
charset = utf-8 | ||
|
||
# Styling applicable to the file extension given | ||
[*.js, *.jsx] | ||
# This is due to the fact that github allows only 119 columns of space to view | ||
max_line_length = 119 | ||
|
||
[*.json] | ||
indent_size = 2 | ||
|
||
# Ignore all the styles due to uglify | ||
[*.min.js] | ||
indent_style = ignore | ||
insert_final_newline = ignore | ||
|
||
[Makefile] | ||
indent_style = tab |
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 @@ | ||
extension/ |
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,59 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"webextensions": true | ||
}, | ||
"extends": [ | ||
"plugin:import/recommended", | ||
"plugin:import/react", | ||
"plugin:promise/recommended", | ||
"plugin:react/recommended", | ||
"standard", | ||
"standard-react" | ||
], | ||
"settings": { | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [ | ||
".js", | ||
".jsx" | ||
], | ||
"moduleDirectory": [ | ||
"node_modules", | ||
"." | ||
] | ||
} | ||
} | ||
}, | ||
"plugins": [ | ||
"standard", | ||
"import", | ||
"promise", | ||
"react" | ||
], | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"rules":{ | ||
"comma-dangle": ["error", "always-multiline"], | ||
"indent": ["error", 4, { "SwitchCase": 1 }], | ||
"react/jsx-indent": ["error", 4], | ||
"react/jsx-indent-props": ["error", 4], | ||
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0 }], | ||
"no-unused-vars": "warn", | ||
"space-before-function-paren": "off", | ||
"operator-linebreak": ["error", "before"], | ||
"import/no-mutable-exports": "error", | ||
"import/unambiguous": "off", | ||
"promise/avoid-new": "off", | ||
"react/jsx-filename-extension": "error", | ||
"react/prefer-stateless-function": "warn", | ||
"react/sort-comp": "warn", | ||
"react/jsx-max-props-per-line": [1, { "when": "multiline" }], | ||
"react/no-unused-prop-types": "warn", | ||
"react/prop-types": "off" | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
|
||
import { createDevTools } from 'redux-devtools' | ||
import LogMonitor from 'redux-devtools-log-monitor' | ||
import DockMonitor from 'redux-devtools-dock-monitor' | ||
|
||
const DevTools = createDevTools( | ||
<DockMonitor | ||
toggleVisibilityKey='ctrl-shift-L' | ||
changePositionKey='ctrl-alt-shift-L' | ||
defaultIsVisible={false} | ||
> | ||
<LogMonitor /> | ||
</DockMonitor> | ||
) | ||
|
||
export default DevTools |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
I would really discuss this one
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.
Actually this is a widely observed standard in many open source projects
This is done so that there is no need for horizontal scrolling while reading the code as github provides only 119 columns worth of space to read the code. But I can change if it seems too restricting.
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.
@Treora makes the final decision, I wouldn't have this rule
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.
The reason here is actually 120, but minus 1 char for the diff view. Why 120 I don't get because it seems pretty much browser specific, and people just choose a round number, see:
(source Django developers discussion)
For more random numbers, see this stackoverflow thread.
I do agree setting line lengths to something higher than 80, but 119 and binding that to Github web view and some browser specifics and then rounding that number seems pretty ... arbitrary.
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 understand github diff works on this length, I'm not discussing the number, I'm dicussing having any number there.
If tomorrow (real life story) I need to put an svg encoded icon somewhere I do want it on one line and I don't care if you have to scroll.
I'm not really worried of a dev writing a very very long line, why would it do that? So I consider this rule more a possible issue than a safeguard.
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.
Point noted, I shall remove this line immediately. Or would you like another value to takes its place?
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 intended to ask about it too; adjusting rules to Github's presentation seems somewhat arbitrary (or submissive ;) ) indeed.
I have myself tried to keep things at a soft limit of 80 characters, though I'd be fine with a larger number too. As said it is nice to be able to make longer lines if needed; I am not sure whether editors interpret such a rule as soft or hard.
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.
If we have a linter it will probably stops you from committing if you have linter errors, so I would say it will be pretty hard :)