-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Improve and introduce measures for consistent code style #4094
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
base: main
Are you sure you want to change the base?
Conversation
Also note that each style rule got introduced in its own commit so we could easily revert one of them if not wanted ;) |
@Mattstir interesting idea 😃 Two questions come to my mind:
|
@softhack007 Thanks for your interest :D
I selected these based on the desired style in the |
WOW code formatting and cleaning is something I also would like to implement in WLED, but also for C and H files. I'll follow this thread! |
Hey! This pull request has been open for quite some time without any new comments now. It will be closed automatically in a week if no further activity occurs. |
WalkthroughThis change set introduces project-wide JavaScript linting and enforces consistent code style using ESLint. A new ESLint configuration file is added, and the development workflow is updated to include linting steps in both the GitHub Actions workflow and the Changes
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 3
🧹 Nitpick comments (3)
eslint.config.mjs (2)
3-3
: Add missing semicolon for consistency.The import statement for the HTML plugin is missing a semicolon, while the other import statements have semicolons.
-import html from "eslint-plugin-html" +import html from "eslint-plugin-html";
6-6
: Fix typo in comment.There's a small typo in the comment.
-// to not complelty change up the whole style at once and introduce huge rebasing problems disable a handfull of recommended rules for now +// to not completely change up the whole style at once and introduce huge rebasing problems disable a handful of recommended rules for nowCONTRIBUTING.md (1)
24-24
: Fix typos in the JavaScript linting guidance.There are a couple of typos in the new linting guidance.
-For javscript content you can use `npm lint` (or just the normal `npm run build` that also executes lint) to make sure you ather to our style. +For JavaScript content you can use `npm lint` (or just the normal `npm run build` that also executes lint) to make sure you adhere to our style.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (30)
.github/workflows/wled-ci.yml
(2 hunks)CONTRIBUTING.md
(1 hunks)eslint.config.mjs
(1 hunks)package.json
(2 hunks)tools/fps_test.htm
(5 hunks)tools/json_test.htm
(1 hunks)wled00/data/cpal/cpal.htm
(17 hunks)wled00/data/dmxmap.htm
(1 hunks)wled00/data/edit.htm
(9 hunks)wled00/data/index.js
(100 hunks)wled00/data/iro.js
(1 hunks)wled00/data/liveview.htm
(3 hunks)wled00/data/liveviewws2D.htm
(3 hunks)wled00/data/msg.htm
(1 hunks)wled00/data/pixart/boxdraw.js
(2 hunks)wled00/data/pixart/getPixelValues.js
(12 hunks)wled00/data/pixart/pixart.js
(15 hunks)wled00/data/pixart/statics.js
(2 hunks)wled00/data/rangetouch.js
(1 hunks)wled00/data/settings.htm
(3 hunks)wled00/data/settings_2D.htm
(8 hunks)wled00/data/settings_dmx.htm
(4 hunks)wled00/data/settings_leds.htm
(21 hunks)wled00/data/settings_sec.htm
(4 hunks)wled00/data/settings_sync.htm
(4 hunks)wled00/data/settings_time.htm
(5 hunks)wled00/data/settings_ui.htm
(8 hunks)wled00/data/settings_um.htm
(13 hunks)wled00/data/settings_wifi.htm
(6 hunks)wled00/data/update.htm
(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
wled00/data/pixart/pixart.js
[error] 231-231: Comparing to itself is potentially pointless.
(lint/suspicious/noSelfCompare)
wled00/data/index.js
[error] 859-859: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 1899-1899: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 2427-2427: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 2428-2428: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
🪛 GitHub Check: Build Enviornments (esp32s3_4M_qspi)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32s3dev_8MB_opi)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32_wrover)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32s3dev_16MB_opi)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp01_1m_full_160)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32c3dev)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (lolin_s2_mini)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32dev)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32dev_audioreactive)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32_eth)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp8266_2m_160)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (nodemcuv2_160)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp01_1m_full)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp8266_2m)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (nodemcuv2)
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Test & Lint
wled00/data/edit.htm
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🔇 Additional comments (57)
eslint.config.mjs (2)
7-31
: Good configuration setup with graduated approach to linting.The common rules configuration is well-structured, with a thoughtful approach of disabling some rules and downgrading others to warnings initially. This allows for a gradual introduction of stricter linting without creating an immediate burden on the codebase. The stylistic rules chosen align with the style preferences in CONTRIBUTING.md.
33-82
: Well-organized configuration with appropriate separation of concerns.The export configuration is well-structured with separate configurations for different file types and locations. The use of common rules across configurations reduces duplication and ensures consistency.
wled00/data/rangetouch.js (1)
1-1
: Good approach for third-party library.Disabling ESLint for this third-party library is appropriate. It allows for integrating the ESLint workflow without requiring modifications to external code.
wled00/data/iro.js (1)
1-1
: Good approach for third-party library.Disabling ESLint for this third-party library is appropriate. It allows for integrating the ESLint workflow without requiring modifications to external code.
wled00/data/msg.htm (1)
8-8
: Semicolon placement improved for style consistency.The semicolon is now correctly placed inside the function body, aligning with standard JavaScript style and ESLint rules. No logic is affected.
.github/workflows/wled-ci.yml (1)
84-95
: Linting integrated into CI workflow.Adding
npm run lint
to the workflow ensures code style is enforced automatically. This is a best practice for code quality.wled00/data/pixart/statics.js (1)
1-1
: Comment formatting improved for consistency.Spaces after
//
improve readability and match style guidelines. No logic is affected.Also applies to: 26-26, 33-33
tools/json_test.htm (1)
85-95
: Whitespace and spacing improved for style compliance.Spaces after
if
and around operators improve readability and comply with linting rules. No logic is affected.wled00/data/pixart/boxdraw.js (1)
12-55
: Whitespace and formatting improved for readability.Spacing and comment formatting changes enhance readability and comply with linting rules. No logic is affected.
wled00/data/update.htm (1)
8-9
: Stylistic improvements approved.Whitespace and comment formatting changes improve readability and align with project style guidelines. No logic is affected.
tools/fps_test.htm (1)
71-79
: Whitespace and formatting changes approved.All modifications are stylistic, improving code readability and consistency without affecting logic.
Also applies to: 85-86, 91-92, 94-95, 99-100, 104-104, 122-122, 128-128, 168-169, 179-179, 184-184
wled00/data/settings_wifi.htm (1)
14-15
: Stylistic changes approved.Whitespace and comment formatting changes enhance readability and maintain consistency with project style guidelines. No logic is affected.
Also applies to: 38-39, 57-57, 71-79, 85-85, 111-112, 115-116, 118-119, 122-125, 127-127, 129-129, 131-131, 137-138, 149-149, 170-170, 150-150
wled00/data/liveview.htm (1)
54-55
: Whitespace and comment formatting changes approved.All changes are stylistic, improving code readability and consistency without affecting logic.
Also applies to: 70-70, 72-72, 76-76, 80-83, 91-93
wled00/data/dmxmap.htm (1)
4-22
: Stylistic whitespace changes approved.Whitespace and formatting improvements enhance readability and maintain consistency with project style guidelines. No logic is affected.
wled00/data/pixart/getPixelValues.js (1)
5-319
: Formatting and style improvements look good.All changes are purely stylistic (spacing, comments, alignment) and do not affect logic or functionality. The code is now more consistent and readable.
wled00/data/liveviewws2D.htm (1)
21-81
: Whitespace and formatting changes are correct.The changes are limited to style and do not affect any logic or behavior. Code readability is improved.
wled00/data/settings_2D.htm (1)
8-304
: Consistent formatting and style improvements.All changes are stylistic and do not affect logic or functionality. The code is now more readable and consistent.
wled00/data/index.js (1)
1-3244
: Formatting and whitespace changes are correct.All changes are stylistic and do not affect logic or functionality. The code is now more consistent and readable. Static analysis hints (e.g., optional chaining, avoiding
delete
) can be considered in a future refactor, but are not required for this style-focused PR.🧰 Tools
🪛 Biome (1.9.4)
[error] 406-406: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 412-412: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 420-420: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 420-420: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 420-420: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 620-620: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 859-859: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 1351-1351: Unexpected control character in a regular expression.
Control characters are unusual and potentially incorrect inputs, so they are disallowed.
(lint/suspicious/noControlCharactersInRegex)
[error] 1899-1899: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 1970-1971: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 2427-2427: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 2428-2428: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 2483-2484: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 2484-2485: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 2485-2486: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 2486-2487: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 2768-2769: Comparing to itself is potentially pointless.
(lint/suspicious/noSelfCompare)
[error] 3067-3068: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 2933-2933: This variable is used before its declaration.
The variable is declared here:
(lint/correctness/noInvalidUseBeforeDeclaration)
[error] 2940-2940: Shouldn't redeclare 'v'. Consider to delete it or rename it.
'v' is defined here:
(lint/suspicious/noRedeclare)
[error] 2944-2944: Shouldn't redeclare 'l2'. Consider to delete it or rename it.
'l2' is defined here:
(lint/suspicious/noRedeclare)
[error] 2947-2947: Shouldn't redeclare 'i'. Consider to delete it or rename it.
'i' is defined here:
(lint/suspicious/noRedeclare)
[error] 62-62: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.(lint/suspicious/noGlobalIsFinite)
wled00/data/settings_sec.htm (2)
24-44
: Whitespace and formatting changes are correct.The changes are limited to style and do not affect any logic or behavior. Code readability is improved.
47-49
: Whitespace and formatting changes are correct.The changes are limited to style and do not affect any logic or behavior. Code readability is improved.
wled00/data/settings_time.htm (6)
8-11
: Improved variable declarations spacing.The variable declarations now have consistent spacing after the assignment operator, following standard JavaScript style conventions.
46-46
: Enhanced slice operation readability.The slice operation now has proper spacing around operators and parameters, making the code more readable.
63-65
: Improved conditional expression formatting.The conditional expressions now have consistent spacing around comparison operators and improved formatting.
70-84
: Improved template string formatting.Template string literals now have consistent spacing, making the code more readable and maintaining consistent style.
107-115
: Enhanced loop and conditional formatting.For loops and conditional expressions now have proper spacing, improving readability and maintaining consistent styling.
121-128
: Standardized assignment operations spacing.Assignment operations and expressions now have proper spacing, following JavaScript best practices.
wled00/data/settings_um.htm (8)
34-36
: Improved comment and code formatting.The conditional statement and comment now have proper spacing, following ESLint guidelines for code style.
57-57
: Enhanced ternary operator spacing.The ternary condition now has proper spacing around the operators, improving readability.
74-75
: Standardized function spacing and formatting.Functions now have consistent spacing between parameters and surrounding code blocks.
112-117
: Improved string comparison and conditional checks.String operations and conditional checks now have proper spacing, following JavaScript best practices.
129-133
: Enhanced function declaration formatting.Function declarations now have consistent spacing around default parameters and string concatenation operations.
159-166
: Standardized indentation and input field generation.The input field generation code now has proper spacing and consistent formatting around string operations.
177-180
: Improved string concatenation formatting.String concatenation operations now have proper spacing, making the code more readable.
260-280
: Enhanced equality checks and parameter spacing.Equality checks and function parameters now have consistent spacing, improving code readability.
wled00/data/cpal/cpal.htm (11)
195-196
: Improved comment formatting.The comment now has proper spacing after the comment delimiter, following ESLint guidelines.
203-204
: Added spacing for array declaration comment.The array declaration comment now has proper spacing, improving code readability.
214-233
: Enhanced comment blocks and function spacing.Comment blocks now have consistent spacing and formatting. Function header comments are properly formatted.
303-307
: Improved conditional statement formatting.The conditional statement now has proper spacing around operators, enhancing readability.
339-352
: Enhanced function declaration and comment blocks.Function declarations and comment blocks now have proper spacing and consistent formatting according to ESLint guidelines.
390-400
: Standardized calculation expressions.Mathematical expressions and array indexing now have consistent spacing, improving code readability.
493-510
: Improved comment block formatting.Comment blocks now have proper spacing and consistent structure, enhancing code readability.
524-530
: Enhanced HTTP request formatting.HTTP request code now has consistent spacing around string concatenation and variable references.
547-561
: Improved comment formatting for palette handling.The comments explaining palette handling now have proper spacing and consistent formatting.
657-663
: Standardized conditional checks and string operations.Conditional checks and string operations now have proper spacing around operators.
671-676
: Enhanced conditional logic formatting.The conditional logic for buttons now has proper spacing and consistent formatting.
wled00/data/settings_sync.htm (4)
7-12
: Improved function and variable declarations.Variable declarations and function definitions now have consistent spacing, following the ESLint guidelines implemented in this PR.
35-54
: Enhanced loop constructs and assignment operations.For loops and variable assignments now have proper spacing around operators and consistent formatting.
55-57
: Standardized function declarations and ternary operations.Function declarations and ternary operations now have consistent spacing and proper formatting.
68-68
: Improved string manipulation formatting.The string manipulation code now has proper spacing around slice operations and method chaining.
wled00/data/pixart/pixart.js (2)
1-8
: Code style improvements in commentsThe spacing after comment delimiters and around operators has been standardized to improve readability.
16-21
: Consistent spacing and formatting improvementsSpacing has been standardized around operators, before blocks, after comments, and in function calls for better readability, meeting the ESLint code style requirements.
Also applies to: 39-41, 82-82, 101-102, 109-110, 129-134, 144-148, 147-156, 159-159, 176-178, 216-217, 230-235, 250-265, 271-273, 281-285, 292-295, 310-319, 325-330, 333-333, 361-364
wled00/data/settings.htm (1)
8-10
: Consistent spacing and formatting improvementsThe changes add proper spacing around variable declarations, function definitions, and string slicing expressions to improve code readability and conform to the project's ESLint configuration.
Also applies to: 41-42
wled00/data/edit.htm (1)
143-149
: Consistent spacing and formatting improvementsSpacing has been standardized around braces, operators, function parameters, and in various control structures to improve code readability, meeting the ESLint code style requirements.
Also applies to: 156-168, 171-208, 213-237, 251-251, 269-271, 428-432, 433-442, 444-448, 450-455, 457-459, 465-504, 506-508, 509-513, 514-522, 523-525, 527-529, 568-574
wled00/data/settings_ui.htm (1)
13-47
: Consistent spacing and formatting improvementsThe changes add proper spacing in object definitions, conditional expressions, ternary operators, string concatenation, and event handlers to improve code readability and conform to the project's ESLint configuration.
Also applies to: 59-65, 81-89, 91-104, 174-174, 186-190, 211-211, 230-233, 270-272
package.json (1)
11-12
: ESLint integration and dependency additions look great.The addition of lint scripts and ESLint-related devDependencies is correct and follows best practices for enforcing code style and quality.
Also applies to: 32-37
wled00/data/settings_dmx.htm (1)
8-82
: Whitespace and formatting improvements are correct and safe.All changes are stylistic and do not affect logic or behavior. The code is now more readable and consistent.
wled00/data/settings_leds.htm (1)
8-927
: Formatting and minor logic fix are correct and beneficial.Whitespace and style changes improve readability and maintainability. The added call to
enABL()
insetABL()
is a positive fix for UI consistency.
files: [ | ||
"tools/**/*.js", | ||
"wled00/data/**/*.js", | ||
"eslint.config.js" |
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.
Update file name to match actual filename.
The file name referenced in the configuration doesn't match the actual filename (mjs vs js).
- "eslint.config.js"
+ "eslint.config.mjs"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"eslint.config.js" | |
"eslint.config.mjs" |
//REMOVED, Any image appear to work as long as it can be drawn to the canvas. Leaving code in for future use, possibly | ||
if (1==1 || base64gifPattern.test(string) || base64pngPattern.test(string) || base64jpgPattern.test(string) || base64webpPattern.test(string)) { | ||
// REMOVED, Any image appear to work as long as it can be drawn to the canvas. Leaving code in for future use, possibly | ||
if (1 == 1 || base64gifPattern.test(string) || base64pngPattern.test(string) || base64jpgPattern.test(string) || base64webpPattern.test(string)) { |
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.
Fix the redundant comparison in conditional check
There's a condition 1 == 1
which is always true. This appears to be a placeholder for validation logic that was commented out.
Consider replacing this with a more meaningful check or remove the comparison entirely:
- if (1 == 1 || base64gifPattern.test(string) || base64pngPattern.test(string) || base64jpgPattern.test(string) || base64webpPattern.test(string)) {
+ // Since validation patterns are commented out, always return true as mentioned in the comment
+ return true;
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if (1 == 1 || base64gifPattern.test(string) || base64pngPattern.test(string) || base64jpgPattern.test(string) || base64webpPattern.test(string)) { | |
// Since validation patterns are commented out, always return true as mentioned in the comment | |
return true; |
🧰 Tools
🪛 Biome (1.9.4)
[error] 231-231: Comparing to itself is potentially pointless.
(lint/suspicious/noSelfCompare)
this.running = true; | ||
if(!req instanceof Object) return; | ||
if (!req instanceof Object) return; |
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.
Fix incorrect instanceof operator negation
The current negation of the instanceof operator is incorrectly placed, which changes the intended logic of the condition.
The negation should be applied to the entire expression, not just to the left operand:
- if (!req instanceof Object) return;
+ if (!(req instanceof Object)) return;
This is a critical issue as the current code will execute the return statement if req
is falsy, regardless of its type, rather than checking if it's not an Object instance.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if (!req instanceof Object) return; | |
if (!(req instanceof Object)) return; |
🧰 Tools
🪛 GitHub Check: Build Enviornments (esp32s3_4M_qspi)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32s3dev_8MB_opi)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32_wrover)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32s3dev_16MB_opi)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp01_1m_full_160)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32c3dev)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (lolin_s2_mini)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32dev)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32dev_audioreactive)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp32_eth)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp8266_2m_160)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (nodemcuv2_160)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp01_1m_full)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (esp8266_2m)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Build Enviornments (nodemcuv2)
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
🪛 GitHub Check: Test & Lint
[warning] 158-158:
Unexpected negating the left operand of 'instanceof' operator
I'm highly passionate about clean code and a consistent code style, so I see this as a great opportunity to enhance WLED. 😉
By introducing ESLint, we can automatically enforce code style during each CI run (and hint at problems during a local
npm build
), ensuring that future changes adhere to the established guidelines. For now, I've aligned the rules with the suggestions in WLED'sCONTRIBUTING.md
and made them mandatory. This is now only a basic start, these rules can be easily expanded in the future to include more than just style.I've also corrected the existing style issues in the
.js
files and js snippets in html files.Note: This PR is purely stylistic with no logic changes. I hope you like it! 😄
Summary by CodeRabbit
New Features
Documentation
Style
Chores