Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
67 lines
1.3 KiB
JavaScript
67 lines
1.3 KiB
JavaScript
/**
|
|
* @fileoverview Rule to check use of chained assignment expressions
|
|
* @author Stewart Rand
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
//------------------------------------------------------------------------------
|
|
|
|
/** @type {import('../types').Rule.RuleModule} */
|
|
module.exports = {
|
|
meta: {
|
|
type: "suggestion",
|
|
|
|
defaultOptions: [
|
|
{
|
|
ignoreNonDeclaration: false,
|
|
},
|
|
],
|
|
|
|
docs: {
|
|
description: "Disallow use of chained assignment expressions",
|
|
recommended: false,
|
|
url: "https://eslint.org/docs/latest/rules/no-multi-assign",
|
|
},
|
|
|
|
schema: [
|
|
{
|
|
type: "object",
|
|
properties: {
|
|
ignoreNonDeclaration: {
|
|
type: "boolean",
|
|
},
|
|
},
|
|
additionalProperties: false,
|
|
},
|
|
],
|
|
|
|
messages: {
|
|
unexpectedChain: "Unexpected chained assignment.",
|
|
},
|
|
},
|
|
|
|
create(context) {
|
|
const [{ ignoreNonDeclaration }] = context.options;
|
|
const selectors = [
|
|
"VariableDeclarator > AssignmentExpression.init",
|
|
"PropertyDefinition > AssignmentExpression.value",
|
|
];
|
|
|
|
if (!ignoreNonDeclaration) {
|
|
selectors.push("AssignmentExpression > AssignmentExpression.right");
|
|
}
|
|
|
|
return {
|
|
[selectors](node) {
|
|
context.report({
|
|
node,
|
|
messageId: "unexpectedChain",
|
|
});
|
|
},
|
|
};
|
|
},
|
|
};
|