Comments (3)
This seems to be intentional
oxc/crates/oxc_semantic/src/lib.rs
Lines 273 to 277 in e4b3a3c
Same behavior in no_unused_private_class_members
rule
oxc/crates/oxc_linter/src/rules/eslint/no_unused_private_class_members.rs
Lines 331 to 337 in e4b3a3c
But I think x += 1
should be flagged as Write
because x
is never used for reading. I believe this variable can be safely removed by the Minifier/Compressor.
Does this make sense?
from oxc.
Hmm. I'm not clear what these flags are meant to represent now!
These are all (broadly) equivalent:
x = x + 1; // Read + Write
x += 1; // Read | Write
x++; // Write
++x; // Write
NB: Also depends on what x
is. If it's an object with a valueOf
method, the any of the above can have side effects.
This also seems to be inconsistent - it flags x
as Read | Write
where it could be just Write
:
let x = 1;
let y = x = 2;
And something strange going on here - the addition of console.log
makes x
Read | Write
:
console.log;
let x = 1;
x++;
from oxc.
Hmm. I'm not clear what these flags are meant to represent now!
These are all (broadly) equivalent:x = x + 1; // Read + Write x += 1; // Read | Write x++; // Write ++x; // Write
The x = x + 1
is not equivalent. This assignment expression has two references. x + 1
will be flagged Read
and x =
will be flagged Write
NB: Also depends on what
x
is. If it's an object with avalueOf
method, the any of the above can have side effects.
Yes! I forgot the valueOf
method.
This also seems to be inconsistent - it flags
x
asRead | Write
where it could be justWrite
:let x = 1; let y = x = 2;
This case is correct. x = 2
should be flagged as Write
and y = x
should be flagged as Read
And something strange going on here - the addition of
console.log
makesx
Read | Write
:console.log; let x = 1; x++;
This is a bug! I will fix it.
from oxc.
Related Issues (20)
- linter: react/require-render-return hangs
- Default configuration file path for linter
- Invalid Unicode escape sequence after 0.4.0 HOT 3
- Avoid Antivirus Message every install/update HOT 1
- "document.cookie" unicorn fail over silent flag HOT 3
- prefer-string-starts-ends-with ignores /i case insensitive modifier
- Update VSCode extention to use project's language server.
- Move VSCode extention to its own repository
- Scheduled and automated releases
- Oxlint fails to parse Typescript
- require-await does not seem to detect await statement in loops HOT 1
- Refactor React JSX transform to remove `update_fragment`
- Multiple scopes for `namespace foo.bar` HOT 3
- `AstBuilder::copy` is unsound
- Make fields of `SourceType` public
- Traverse should exit scope before `exit_` method called if not entered at start HOT 1
- I can't find any example how to use `overrides`, and the way I use `overrides` in eslint doesn't seem to apply. HOT 2
- Unicode escape issue in `oxc_codegen::Codegen`
- Catch panics in conformance tests HOT 1
- Catch illegal TS module syntax in semantic
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oxc.