This is implementate ESLint architecture for PHP code lint
cd ./phplint
composer intall
./bin/php-lint ./test/mock/rule/
-
Reporter
-
Fixer
-
Rules
-
Config
-
Plugin
- Options Schemas
- report
- options
context.report({
node: node,
message: "Unexpected identifier: {{ identifier }}",
data: {
identifier: node.name
}
});
- fix
context.report({
node: node,
message: "Missing semicolon",
fix: function(fixer) {
return fixer.insertTextAfter(node, ";");
}
});
meta: {
docs: {
description: "disallow unnecessary semicolons",
category: "Possible Errors",
recommended: true
},
fixable: "code",
schema: [] // no options,
deprecated: false,
},
The rule naming conventions for ESLint are fairly simple:
- If your rule is disallowing something, prefix it with no- such as no-eval for disallowing eval() and no-debugger for disallowing debugger.
- If your rule is enforcing the inclusion of something, use a short name without a special prefix.
- Keep your rule names as short as possible, use abbreviations where appropriate, and no more than four words.
- Use dashes between words.