Skip to content

DragorWW/phplint

Repository files navigation

Build Status

PHP Lint

This is implementate ESLint architecture for PHP code lint

inatall

cd ./phplint
composer intall

Usage

./bin/php-lint ./test/mock/rule/

architecture

Rules

  • 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,
},

Rule Naming Conventions

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.

About

AST-based PHP linter written PHP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages