Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support flat config with FlatESLint #947

Open
KTibow opened this issue Dec 16, 2023 · 7 comments
Open

feat: support flat config with FlatESLint #947

KTibow opened this issue Dec 16, 2023 · 7 comments

Comments

@KTibow
Copy link

KTibow commented Dec 16, 2023

Versions:

  • prettier-eslint version: latest (using prettier-eslint-cli)
  • node version: v21.1.0
  • pnpm version: 8.7.4

Have you followed the debugging tips?
Yes

Relevant code

<h1 class="var-crsv mb-6 mt-12 text-center text-5xl">more pages</h1>

What I did:
Ran pnpm dlx prettier-eslint-cli src/routes/more/+page.svelte --write --log-level debug

What happened:
It did not sort the unocss rules, even though my ESlint config (flat) has unocss enabled, and eslint --fix src/routes/more/+page.svelte works fine

Logs:

prettier-eslint [DEBUG]: getting eslint config for file at "/home/kendell/Documents/Projects/SchoolHub/src/routes/more/+page.svelte"
prettier-eslint [DEBUG]: Unable to find config
prettier-eslint [DEBUG]: turning off unfixable rules
prettier-eslint [DEBUG]: The tabWidth rule is not configured, let prettier decide
prettier-eslint [DEBUG]: The singleQuote rule is not configured, let prettier decide
prettier-eslint [DEBUG]: The trailingComma rule is not configured, let prettier decide
prettier-eslint [DEBUG]: The bracketSpacing rule is not configured, let prettier decide
prettier-eslint [DEBUG]: The semi rule is not configured, let prettier decide
prettier-eslint [DEBUG]: The useTabs rule is not configured, let prettier decide
prettier-eslint [DEBUG]: The bracketSameLine rule is not configured, let prettier decide
prettier-eslint [DEBUG]: The arrowParens rule is not configured, let prettier decide
prettier-eslint [DEBUG]: inferred options: Object {
  "eslintConfig": Object {
    "fix": true,
    "globals": Object {},
    "rules": Object {
      "accessor-pairs": Array [
        "off",
      ],
      "array-callback-return": Array [
        "off",
      ],
      "block-scoped-var": Array [
        "off",
      ],
      "callback-return": Array [
        "off",
      ],
      "camelcase": Array [
        "off",
      ],
      "class-methods-use-this": Array [
        "off",
      ],
      "complexity": Array [
        "off",
      ],
      "consistent-return": Array [
        "off",
      ],
      "consistent-this": Array [
        "off",
      ],
      "constructor-super": Array [
        "off",
      ],
      "default-case": Array [
        "off",
      ],
      "default-case-last": Array [
        "off",
      ],
      "default-param-last": Array [
        "off",
      ],
      "for-direction": Array [
        "off",
      ],
      "func-name-matching": Array [
        "off",
      ],
      "func-names": Array [
        "off",
      ],
      "func-style": Array [
        "off",
      ],
      "getter-return": Array [
        "off",
      ],
      "global-require": Array [
        "off",
      ],
      "grouped-accessor-pairs": Array [
        "off",
      ],
      "guard-for-in": Array [
        "off",
      ],
      "handle-callback-err": Array [
        "off",
      ],
      "id-blacklist": Array [
        "off",
      ],
      "id-denylist": Array [
        "off",
      ],
      "id-length": Array [
        "off",
      ],
      "id-match": Array [
        "off",
      ],
      "init-declarations": Array [
        "off",
      ],
      "line-comment-position": Array [
        "off",
      ],
      "max-classes-per-file": Array [
        "off",
      ],
      "max-depth": Array [
        "off",
      ],
      "max-len": Array [
        "off",
      ],
      "max-lines": Array [
        "off",
      ],
      "max-lines-per-function": Array [
        "off",
      ],
      "max-nested-callbacks": Array [
        "off",
      ],
      "max-params": Array [
        "off",
      ],
      "max-statements": Array [
        "off",
      ],
      "max-statements-per-line": Array [
        "off",
      ],
      "new-cap": Array [
        "off",
      ],
      "no-alert": Array [
        "off",
      ],
      "no-array-constructor": Array [
        "off",
      ],
      "no-async-promise-executor": Array [
        "off",
      ],
      "no-await-in-loop": Array [
        "off",
      ],
      "no-bitwise": Array [
        "off",
      ],
      "no-buffer-constructor": Array [
        "off",
      ],
      "no-caller": Array [
        "off",
      ],
      "no-case-declarations": Array [
        "off",
      ],
      "no-catch-shadow": Array [
        "off",
      ],
      "no-class-assign": Array [
        "off",
      ],
      "no-compare-neg-zero": Array [
        "off",
      ],
      "no-cond-assign": Array [
        "off",
      ],
      "no-console": Array [
        "off",
      ],
      "no-const-assign": Array [
        "off",
      ],
      "no-constant-binary-expression": Array [
        "off",
      ],
      "no-constant-condition": Array [
        "off",
      ],
      "no-constructor-return": Array [
        "off",
      ],
      "no-continue": Array [
        "off",
      ],
      "no-control-regex": Array [
        "off",
      ],
      "no-debugger": Array [
        "off",
      ],
      "no-delete-var": Array [
        "off",
      ],
      "no-dupe-args": Array [
        "off",
      ],
      "no-dupe-class-members": Array [
        "off",
      ],
      "no-dupe-else-if": Array [
        "off",
      ],
      "no-dupe-keys": Array [
        "off",
      ],
      "no-duplicate-case": Array [
        "off",
      ],
      "no-duplicate-imports": Array [
        "off",
      ],
      "no-empty": Array [
        "off",
      ],
      "no-empty-character-class": Array [
        "off",
      ],
      "no-empty-function": Array [
        "off",
      ],
      "no-empty-pattern": Array [
        "off",
      ],
      "no-empty-static-block": Array [
        "off",
      ],
      "no-eq-null": Array [
        "off",
      ],
      "no-eval": Array [
        "off",
      ],
      "no-ex-assign": Array [
        "off",
      ],
      "no-extend-native": Array [
        "off",
      ],
      "no-fallthrough": Array [
        "off",
      ],
      "no-func-assign": Array [
        "off",
      ],
      "no-global-assign": Array [
        "off",
      ],
      "no-implicit-globals": Array [
        "off",
      ],
      "no-implied-eval": Array [
        "off",
      ],
      "no-import-assign": Array [
        "off",
      ],
      "no-inline-comments": Array [
        "off",
      ],
      "no-inner-declarations": Array [
        "off",
      ],
      "no-invalid-regexp": Array [
        "off",
      ],
      "no-invalid-this": Array [
        "off",
      ],
      "no-irregular-whitespace": Array [
        "off",
      ],
      "no-iterator": Array [
        "off",
      ],
      "no-label-var": Array [
        "off",
      ],
      "no-labels": Array [
        "off",
      ],
      "no-lone-blocks": Array [
        "off",
      ],
      "no-loop-func": Array [
        "off",
      ],
      "no-loss-of-precision": Array [
        "off",
      ],
      "no-magic-numbers": Array [
        "off",
      ],
      "no-misleading-character-class": Array [
        "off",
      ],
      "no-mixed-operators": Array [
        "off",
      ],
      "no-mixed-requires": Array [
        "off",
      ],
      "no-mixed-spaces-and-tabs": Array [
        "off",
      ],
      "no-multi-assign": Array [
        "off",
      ],
      "no-multi-str": Array [
        "off",
      ],
      "no-native-reassign": Array [
        "off",
      ],
      "no-negated-condition": Array [
        "off",
      ],
      "no-negated-in-lhs": Array [
        "off",
      ],
      "no-nested-ternary": Array [
        "off",
      ],
      "no-new": Array [
        "off",
      ],
      "no-new-func": Array [
        "off",
      ],
      "no-new-native-nonconstructor": Array [
        "off",
      ],
      "no-new-object": Array [
        "off",
      ],
      "no-new-require": Array [
        "off",
      ],
      "no-new-symbol": Array [
        "off",
      ],
      "no-new-wrappers": Array [
        "off",
      ],
      "no-nonoctal-decimal-escape": Array [
        "off",
      ],
      "no-obj-calls": Array [
        "off",
      ],
      "no-object-constructor": Array [
        "off",
      ],
      "no-octal": Array [
        "off",
      ],
      "no-octal-escape": Array [
        "off",
      ],
      "no-param-reassign": Array [
        "off",
      ],
      "no-path-concat": Array [
        "off",
      ],
      "no-plusplus": Array [
        "off",
      ],
      "no-process-env": Array [
        "off",
      ],
      "no-process-exit": Array [
        "off",
      ],
      "no-promise-executor-return": Array [
        "off",
      ],
      "no-proto": Array [
        "off",
      ],
      "no-prototype-builtins": Array [
        "off",
      ],
      "no-redeclare": Array [
        "off",
      ],
      "no-restricted-exports": Array [
        "off",
      ],
      "no-restricted-globals": Array [
        "off",
      ],
      "no-restricted-imports": Array [
        "off",
      ],
      "no-restricted-modules": Array [
        "off",
      ],
      "no-restricted-properties": Array [
        "off",
      ],
      "no-restricted-syntax": Array [
        "off",
      ],
      "no-return-assign": Array [
        "off",
      ],
      "no-return-await": Array [
        "off",
      ],
      "no-script-url": Array [
        "off",
      ],
      "no-self-assign": Array [
        "off",
      ],
      "no-self-compare": Array [
        "off",
      ],
      "no-sequences": Array [
        "off",
      ],
      "no-setter-return": Array [
        "off",
      ],
      "no-shadow": Array [
        "off",
      ],
      "no-shadow-restricted-names": Array [
        "off",
      ],
      "no-sparse-arrays": Array [
        "off",
      ],
      "no-sync": Array [
        "off",
      ],
      "no-tabs": Array [
        "off",
      ],
      "no-template-curly-in-string": Array [
        "off",
      ],
      "no-ternary": Array [
        "off",
      ],
      "no-this-before-super": Array [
        "off",
      ],
      "no-throw-literal": Array [
        "off",
      ],
      "no-undef": Array [
        "off",
      ],
      "no-undefined": Array [
        "off",
      ],
      "no-underscore-dangle": Array [
        "off",
      ],
      "no-unexpected-multiline": Array [
        "off",
      ],
      "no-unmodified-loop-condition": Array [
        "off",
      ],
      "no-unreachable": Array [
        "off",
      ],
      "no-unreachable-loop": Array [
        "off",
      ],
      "no-unsafe-finally": Array [
        "off",
      ],
      "no-unsafe-negation": Array [
        "off",
      ],
      "no-unsafe-optional-chaining": Array [
        "off",
      ],
      "no-unused-expressions": Array [
        "off",
      ],
      "no-unused-private-class-members": Array [
        "off",
      ],
      "no-unused-vars": Array [
        "off",
      ],
      "no-use-before-define": Array [
        "off",
      ],
      "no-useless-backreference": Array [
        "off",
      ],
      "no-useless-call": Array [
        "off",
      ],
      "no-useless-catch": Array [
        "off",
      ],
      "no-useless-concat": Array [
        "off",
      ],
      "no-useless-constructor": Array [
        "off",
      ],
      "no-useless-escape": Array [
        "off",
      ],
      "no-void": Array [
        "off",
      ],
      "no-warning-comments": Array [
        "off",
      ],
      "no-with": Array [
        "off",
      ],
      "prefer-named-capture-group": Array [
        "off",
      ],
      "prefer-promise-reject-errors": Array [
        "off",
      ],
      "prefer-reflect": Array [
        "off",
      ],
      "prefer-regex-literals": Array [
        "off",
      ],
      "prefer-rest-params": Array [
        "off",
      ],
      "prefer-spread": Array [
        "off",
      ],
      "radix": Array [
        "off",
      ],
      "require-atomic-updates": Array [
        "off",
      ],
      "require-await": Array [
        "off",
      ],
      "require-jsdoc": Array [
        "off",
      ],
      "require-unicode-regexp": Array [
        "off",
      ],
      "require-yield": Array [
        "off",
      ],
      "sort-keys": Array [
        "off",
      ],
      "symbol-description": Array [
        "off",
      ],
      "use-isnan": Array [
        "off",
      ],
      "valid-typeof": Array [
        "off",
      ],
      "vars-on-top": Array [
        "off",
      ],
    },
    "useEslintrc": false,
  },
  "eslintPath": "/home/kendell/Documents/Projects/SchoolHub/node_modules/.pnpm/eslint@8.55.0/node_modules/eslint/lib/api.js",
  "filePath": "/home/kendell/Documents/Projects/SchoolHub/src/routes/more/+page.svelte",
  "logLevel": "debug",
  "prettierLast": false,
  "prettierOptions": Object {
    "arrowParens": undefined,
    "bracketSpacing": undefined,
    "filepath": "/home/kendell/Documents/Projects/SchoolHub/src/routes/more/+page.svelte",
    "insertPragma": undefined,
    "plugins": Array [
      "prettier-plugin-svelte",
    ],
    "printWidth": 100,
    "proseWrap": undefined,
    "requirePragma": undefined,
    "semi": undefined,
    "singleQuote": undefined,
    "useTabs": undefined,
  },
  "prettierPath": "/home/kendell/Documents/Projects/SchoolHub/node_modules/.pnpm/prettier@3.1.1/node_modules/prettier/index.cjs",
  "text": "
<h1 class=\"var-crsv mb-6 mt-12 text-center text-5xl\">more pages</h1>
",
}
prettier-eslint [DEBUG]: calling prettier on text

Suggested solution:
Fix the bug? Not sure what to say

@JounQin
Copy link
Member

JounQin commented Dec 16, 2023

Online reproduction required.

@KTibow
Copy link
Author

KTibow commented Dec 17, 2023

@JounQin JounQin changed the title Seems to not be running eslint --fix properly (flat config issue?) feat: support flat config with FlatESLint Dec 17, 2023
@JounQin JounQin self-assigned this Dec 17, 2023
@JounQin
Copy link
Member

JounQin commented Dec 17, 2023

Related codes:

return new ESLint(eslintOptions);

We need to construct new FlatESLint for flat config instead.

PR welcome if you're interested, otherwise I may help to add this feature later when I'm free.

Copy link
Contributor

Stale issue

@KTibow
Copy link
Author

KTibow commented Feb 16, 2024

Nope

Copy link
Contributor

Stale issue

@KTibow
Copy link
Author

KTibow commented Apr 17, 2024

Nope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants