Preparing for the transition to an updated linter, standardizing the code base#31
Open
In1quity wants to merge 2 commits intowikimedia-gadgets:masterfrom
Open
Preparing for the transition to an updated linter, standardizing the code base#31In1quity wants to merge 2 commits intowikimedia-gadgets:masterfrom
In1quity wants to merge 2 commits intowikimedia-gadgets:masterfrom
Conversation
## ESLint Configuration Added:
- Added .eslintrc.json with comprehensive rules for code quality
- Configured for ESLint 6.x compatibility
- Applied strict code style standards across entire codebase
## ESLint Rules Implemented:
- indent: ["error", "tab"] - Enforce tab indentation with SwitchCase support
- no-tabs: ["error", {"allowIndentationTabs": true}] - Disallow tabs except for indentation
- no-multiple-empty-lines: ["error", {"max": 1, "maxBOF": 0, "maxEOF": 0}] - Limit consecutive empty lines
- max-len: ["warn", {"code": 100, "tabWidth": 4, "ignoreUrls": true, "ignoreStrings": true, "ignoreTemplateLiterals": true}] - Enforce 100 character line limit
- linebreak-style: ["error", "unix"] - Enforce Unix line endings (LF)
- quotes: ["error", "double"] - Enforce double quotes
- semi: ["error", "always"] - Enforce semicolons
## Code Fixes Applied:
- 27 no-tabs errors: Removed all tab characters from code content (kept for indentation)
- 48 max-len warnings: Reformatted long lines to fit within 100 character limit
- 4724 linebreak-style errors: Converted all Windows CRLF line endings to Unix LF
- Multiple formatting issues: Fixed spacing, indentation, and code structure
## Files Modified:
- .eslintrc.json: Added ESLint configuration
- index.js: Fixed line length and formatting
- All rater-src/*.js files: Applied consistent code style
- All Windows/Components/*.js files: Fixed formatting and line length
## Result:
- 0 ESLint errors
- 0 ESLint warnings
- All code now follows consistent style guidelines
- Improved code readability and maintainability
- Set * text=auto for automatic line ending detection - Set *.js text eol=lf to enforce Unix line endings for JavaScript files - Ensures consistent line endings across different operating systems
Open
Member
|
I'm not a big fan of max-len. That makes things easier for certain Linux users that use simple text editors without word wrapping, but makes things harder for the rest of us who have to hit enter a bunch of times when writing code comments, or fix the enters when we modify code comments. I don't think I want to merge a PR that has max-len in it. linebreak-style seems like a good one to do. I would accept a PR that just had that rule added and its autofixes. In general, smaller PRs are better. One PR per rule. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
To apply new rules, linters or whatever and to do it as safely as possible, we first need to fix the tabs and linebreak-style (CLRF vs LF). Because this change breaks diffs and prevents PR from being checked properly.
ESLint Configuration Added:
ESLint Wikimedia Rules Implemented:
Code Fixes Applied:
Files Modified: