mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
- Removed all Snow consensus code and dependencies - Replaced snow.Context with consensuscontext.Context - Updated all imports and references - Added comprehensive test suites for core packages - Fixed all build errors and test failures - Achieved 100% test pass rate (21 packages passing) - Improved test coverage to 30% Breaking changes: - Removed snow package entirely - Changed VM interface to use VMState instead of snow.State - Updated ChainContext structure Tests added: - core/app_error_test.go: 100% coverage - core/bootstrap_test.go: comprehensive concurrent tests - core/health_test.go: full integration tests - validators/validators_test.go: complete interface tests - version/version_test.go: 100% coverage - codec/codec_test.go: marshal/unmarshal tests - context/context_test.go: all functions tested
84 lines
2.4 KiB
JavaScript
84 lines
2.4 KiB
JavaScript
/**
|
|
* @fileoverview Rule to check that spaced function application
|
|
* @author Matt DuVall <http://www.mattduvall.com>
|
|
* @deprecated in ESLint v3.3.0
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
//------------------------------------------------------------------------------
|
|
|
|
/** @type {import('../shared/types').Rule} */
|
|
module.exports = {
|
|
meta: {
|
|
type: "layout",
|
|
|
|
docs: {
|
|
description: "Disallow spacing between function identifiers and their applications (deprecated)",
|
|
recommended: false,
|
|
url: "https://eslint.org/docs/latest/rules/no-spaced-func"
|
|
},
|
|
|
|
deprecated: true,
|
|
|
|
replacedBy: ["func-call-spacing"],
|
|
|
|
fixable: "whitespace",
|
|
schema: [],
|
|
|
|
messages: {
|
|
noSpacedFunction: "Unexpected space between function name and paren."
|
|
}
|
|
},
|
|
|
|
create(context) {
|
|
|
|
const sourceCode = context.sourceCode;
|
|
|
|
/**
|
|
* Check if open space is present in a function name
|
|
* @param {ASTNode} node node to evaluate
|
|
* @returns {void}
|
|
* @private
|
|
*/
|
|
function detectOpenSpaces(node) {
|
|
const lastCalleeToken = sourceCode.getLastToken(node.callee);
|
|
let prevToken = lastCalleeToken,
|
|
parenToken = sourceCode.getTokenAfter(lastCalleeToken);
|
|
|
|
// advances to an open parenthesis.
|
|
while (
|
|
parenToken &&
|
|
parenToken.range[1] < node.range[1] &&
|
|
parenToken.value !== "("
|
|
) {
|
|
prevToken = parenToken;
|
|
parenToken = sourceCode.getTokenAfter(parenToken);
|
|
}
|
|
|
|
// look for a space between the callee and the open paren
|
|
if (parenToken &&
|
|
parenToken.range[1] < node.range[1] &&
|
|
sourceCode.isSpaceBetweenTokens(prevToken, parenToken)
|
|
) {
|
|
context.report({
|
|
node,
|
|
loc: lastCalleeToken.loc.start,
|
|
messageId: "noSpacedFunction",
|
|
fix(fixer) {
|
|
return fixer.removeRange([prevToken.range[1], parenToken.range[0]]);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
return {
|
|
CallExpression: detectOpenSpaces,
|
|
NewExpression: detectOpenSpaces
|
|
};
|
|
|
|
}
|
|
};
|