docs: {
description: "Disallow use of `this` in contexts where the value of `this` is `undefined`",
recommended: false,
- url: "https://eslint.org/docs/rules/no-invalid-this"
+ url: "https://eslint.org/docs/latest/rules/no-invalid-this"
},
schema: [
const options = context.options[0] || {};
const capIsConstructor = options.capIsConstructor !== false;
const stack = [],
- sourceCode = context.getSourceCode();
+ sourceCode = context.sourceCode;
/**
* Gets the current checking context.
}
if (codePath.origin === "program") {
- const scope = context.getScope();
+ const scope = sourceCode.getScope(node);
const features = context.parserOptions.ecmaFeatures || {};
// `this` at the top level of scripts always refers to the global object
* always valid, so we can set `init: true` right away.
*/
stack.push({
- init: !context.getScope().isStrict,
+ init: !sourceCode.getScope(node).isStrict,
node,
valid: true
});