Skip to content

Commit

Permalink
chore: add a few todos
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Dec 8, 2023
1 parent aa17b17 commit c74a3bb
Show file tree
Hide file tree
Showing 26 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion lib/rules/fixer-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = {

return {
Program(ast) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
contextIdentifiers = utils.getContextIdentifiers(
sourceCode.scopeManager,
ast
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/meta-property-ordering.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const ruleInfo = getRuleInfo(sourceCode);
if (!ruleInfo) {
return {};
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-deprecated-context-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9

// ----------------------------------------------------------------------
// Public
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-deprecated-report-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
let contextIdentifiers;

// ----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-identical-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
// ----------------------------------------------------------------------
// Public
// ----------------------------------------------------------------------
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9

// ----------------------------------------------------------------------
// Helpers
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-missing-message-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const { scopeManager } = sourceCode;
const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-missing-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const { scopeManager } = sourceCode;

let contextIdentifiers;
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-only-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = {
messageId: 'removeOnly',
*fix(fixer) {
const sourceCode =
context.sourceCode || context.getSourceCode();
context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9

const tokenBefore =
sourceCode.getTokenBefore(onlyProperty);
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unused-message-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const { scopeManager } = sourceCode;
const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unused-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const { scopeManager } = sourceCode;

let contextIdentifiers;
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-useless-token-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9

// ----------------------------------------------------------------------
// Helpers
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-message-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
return {};
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-object-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
// Public
// ----------------------------------------------------------------------

const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
return {};
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-output-null.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
// Public
// ----------------------------------------------------------------------

const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9

return {
Program(ast) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
create(context) {
let contextIdentifiers;

const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const { scopeManager } = sourceCode;

// ----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-replace-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
let funcInfo = {
upper: null,
codePath: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/report-message-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = {
}
}

const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
return {};
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/require-meta-docs-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
return {};
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/require-meta-docs-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = {
*/
create(context) {
const options = context.options[0] || {};
const filename = context.filename || context.getFilename();
const filename = context.filename || context.getFilename(); // TODO: just use context.filename when dropping eslint < v9
const ruleName =
filename === '<input>'
? undefined
Expand All @@ -72,7 +72,7 @@ module.exports = {
);
}

const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const ruleInfo = util.getRuleInfo(sourceCode);
if (!ruleInfo) {
return {};
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/require-meta-fixable.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
const catchNoFixerButFixableProperty =
context.options[0] && context.options[0].catchNoFixerButFixableProperty;

const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const { scopeManager } = sourceCode;
const ruleInfo = utils.getRuleInfo(sourceCode);
let contextIdentifiers;
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/require-meta-has-suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const { scopeManager } = sourceCode;
const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/require-meta-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
},

create(context) {
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const { scopeManager } = sourceCode;
const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/require-meta-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = {
// Public
// ----------------------------------------------------------------------

const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9
const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
return {};
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/test-case-property-ordering.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = {
'env',
'errors',
];
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9

return {
Program(ast) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/test-case-shorthand-strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {

create(context) {
const shorthandOption = context.options[0] || 'as-needed';
const sourceCode = context.sourceCode || context.getSourceCode();
const sourceCode = context.sourceCode || context.getSourceCode(); // just use context.sourceCode when dropping eslint < v9

// ----------------------------------------------------------------------
// Helpers
Expand Down
1 change: 1 addition & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ module.exports = {
statements,
variableIdentifiers = new Set()
) {
const sourceCode = context.sourceCode || context.getSourceCode(); // TODO: just use context.sourceCode when dropping eslint < v9
const runCalls = [];

for (const statement of statements) {
Expand Down

0 comments on commit c74a3bb

Please sign in to comment.