Skip to content

Not working with ESLint 9. #5

@dannyniu

Description

@dannyniu

I've configured this plugin with the following configuration file in ESLint 9:

import globals from "globals";
import pluginJs from "@eslint/js";

import html from "eslint-plugin-html";
import php from "eslint-plugin-php-markup"

/** @type {import('eslint').Linter.Config[]} */
export default [
  {languageOptions: { globals: globals.browser }},
  pluginJs.configs.recommended,
  {files: ["**/*.js"], languageOptions: {sourceType: "script"}},
  {files: ["**/*.php", "**/*.html"], plugins: { html, php }, settings: {
    "php/php-extensions": [ ".php" ],
    "php/markup-replacement": { "php": "!!!!", "=": "0" },
    "php/keep-eol": false,
    "php/remove-whitespace": false,
    "php/remove-empty-line": false,
    "php/remove-php-lint": false
  }},
  {
    "rules": {
      "no-redeclare": "warn",
      "no-unused-vars": "warn",
      "no-redeclare": "warn",
      "no-extra-semi": "off",
      "no-empty": "off",
      "no-inner-declarations": "off",
      "no-useless-escape": "off"
    },
  },
];

And try to lint this PHP file:

<script>
foo = 2;
console.log(bar);
var v = "<?php echo "123"; ?>";
</script>

And I got this on my command line:

$ npx eslint sandbox/eslint.php

/Users/dannyniu/sandbox/eslint.php
  4:22  error  Parsing error: Unexpected token 123

✖ 1 problem (1 error, 0 warnings)

Environment:

$ node --version ; npm --version ; npm list
v20.18.1
9.9.3
dannyniu@ /Users/dannyniu
├── @eslint/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions