Installations
npm install @zibuthe7j11/alias-rem-consequuntur
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
20.12.2
NPM Version
10.5.0
Score
67.9
Supply Chain
99.2
Quality
76.1
Maintenance
100
Vulnerability
100
License
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
validate.email 🚀
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Developer
zibuthe7j11
Download Statistics
Total Downloads
125
Last Day
1
Last Week
1
Last Month
15
Last Year
125
GitHub Statistics
MIT License
9 Commits
1 Branches
Updated on Apr 27, 2024
Package Meta Information
Latest Version
1.0.0
Package Id
@zibuthe7j11/alias-rem-consequuntur@1.0.0
Unpacked Size
12.66 kB
Size
5.46 kB
File Count
10
NPM Version
10.5.0
Node Version
20.12.2
Published on
Apr 26, 2024
Total Downloads
Cumulative downloads
Total Downloads
125
Last Day
0%
1
Compared to previous day
Last Week
0%
1
Compared to previous week
Last Month
114.3%
15
Compared to previous month
Last Year
0%
125
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
@zibuthe7j11/alias-rem-consequuntur
Marks all side-effects in module initialization that will interfere with tree-shaking
Usage
This plugin is intended as a means for library developers to identify patterns that will interfere with the tree-shaking algorithm of their module bundler (i.e. rollup or webpack).
JavaScript:
1myGlobal = 17; 2const x = { [globalFunction()]: "myString" }; 3 4export default 42;
Rollup output:
1myGlobal = 17; 2const x = { [globalFunction()]: "myString" }; 3 4var index = 42; 5 6export default index;
ESLint output:
1:1 error Cannot determine side-effects of assignment to global variable
2:13 error Cannot determine side-effects of calling global function
This plugin is most useful when you integrate ESLint with your editor.
Installation and Setup
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install @zibuthe7j11/alias-rem-consequuntur
:
$ npm install @zibuthe7j11/alias-rem-consequuntur --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install @zibuthe7j11/alias-rem-consequuntur
globally.
Add tree-shaking
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
1{ 2 "plugins": ["tree-shaking"] 3}
Then add the rule no-side-effects-in-initialization
to the rules section:
1{ 2 "rules": { 3 "tree-shaking/no-side-effects-in-initialization": 2 4 } 5}
To prevent false positives, configure like this:
1{ 2 "rules": { 3 "tree-shaking/no-side-effects-in-initialization": [ 4 2, 5 { 6 "noSideEffectsWhenCalled": [ 7 { "function": "Object.freeze" }, 8 { 9 "module": "react", 10 "functions": ["createContext", "createRef"] 11 }, 12 { 13 "module": "zod", 14 "functions": ["array", "string", "nativeEnum", "number", "object", "optional"] 15 }, 16 { 17 "module": "my/local/module", 18 "functions": ["foo", "bar", "baz"] 19 } 20 ] 21 } 22 ] 23 } 24}
Magic Comments
ESLint only ever analyzes one file at a time and by default, this plugin assumes that all imported functions have side-effects. If this is not the case, this plugin supports magic comments you can add before identifiers in imports and exports to specify that you assume an import or export to be a pure function. Examples:
-
By default, imported functions are assumed to have side-effects:
JavaScript:
1import { x } from "./some-file"; 2x();
ESLint output:
1:9 error Cannot determine side-effects of calling imported function
-
You can mark a side-effect free import with a magic comment:
JavaScript:
1import { /* tree-shaking no-side-effects-when-called */ x } from "./some-file"; 2x();
No ESLint errors
-
By default, exported functions are not checked for side-effects:
JavaScript:
1export const x = globalFunction;
No ESLint errors
-
You can check exports for side-effects with a magic comment:
JavaScript:
1export const /* tree-shaking no-side-effects-when-called */ x = globalFunction;
ESLint output:
1:65 error Cannot determine side-effects of calling global function
Background and Planned Development
This plugin is in development. If you want to contribute, please read CONTRIBUTING.md.
This plugin implements a side-effect detection algorithm similar to what rollup uses to determine if code can be removed safely. However, there is no one-to-one correspondence. If you find that you have code that
- is not removed by rollup (even though tree-shaking is enabled) but
- has no ESLint issues
please--if no-one else has done so yet--check the guidelines and file an issue!

No vulnerabilities found.

No security vulnerabilities found.