Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# prefer extracted top level constant

Consider extracting the constant to the top level scope:

```javascript
const %{name} = %{value}

// the rest of your code below it
export %{method.signature}
```

Only functions, classes and constants that are `export`ed, are visible and accessible from the outside.
These constants can live in the same file without being exposed to other code.
Also, extracting constants saves memory by avoiding repeated allocations in functions when those same constants are reused.