Skip to content

Commit

Permalink
fix: scope context
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyhuman committed Nov 5, 2024
1 parent af193ca commit 5be110d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/StateSnapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ export default {
},
create(context) {
// FIX: remove when dropping support for < v9
const sourceCode = context.sourceCode || context.getSourceCode()
var sourceCode = context.sourceCode || context.getSourceCode()
var getScope =
'getScope' in context
? context.getScope.bind(context)
: sourceCode.getScope.bind(sourceCode)
return {
Identifier(node) {
const scope = sourceCode.getScope(node)
const scope = getScope(node)

if (isInComputed(node) && isInProperty(node)) {
if (
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const plugin = {
Object.assign(plugin, {
configs: {
recommended: {
plugins: ['valtio'],
plugins: { valtio: plugin },
rules: {
'valtio/state-snapshot-rule': 'warn',
'valtio/avoid-this-in-proxy': 'warn',
Expand Down

0 comments on commit 5be110d

Please sign in to comment.