https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39059
Bug ID: 39059
Summary: Do not use "semi: false" for .vue files
Change sponsored?: ---
Product: Koha
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P5 - low
Component: Architecture, internals, and plumbing
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
Blocks: 38664
.vue files are kept tidy since we introduced them. And the prettier rule "semi:
false;" has been used since then.
In JavaScript, the use of semicolons (;) to terminate statements is optional
due to a feature called Automatic Semicolon Insertion (ASI). This mechanism
allows developers to write code without explicit semicolons: the JS engine
automatically inserts them where necessary.
Pro: omitting semicolons leads to cleaner and more readable code by reducing
visual clutter. Modern tools catch potential issues arising from ASI, making
explicit semicolons redundant.
However, relying only on ASI can introduce subtle bugs.
For instance:
```
function getValue() {
return
{
value: 42
}
}
```
A semicolon is automatically inserted after the return statement: the function
returns undefined instead of the object. This happens because it is interpreted
as:
```
function getValue() {
return;
{
value: 42
}
}
```
Such unintended behavior can be avoided by explicitly using semicolons.
One source: https://github.com/airbnb/javascript?tab=readme-ov-file#semicolons
Referenced Bugs:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38664
[Bug 38664] Tidy the whole codebase
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/