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

WIP: feat: migrate to FlatConfig #64

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

yoshinorin
Copy link
Member

Refs: #55

check list

  • Add test cases for the changes.
  • Passed the CI test.

Description

Additional information

@yoshinorin yoshinorin assigned yoshinorin and unassigned yoshinorin Sep 20, 2024
eslint.js Show resolved Hide resolved
"@eslint/js": "^9.10.0",
"eslint-plugin-n": "^17.10.3",
"globals": "^15.9.0",
"typescript-eslint": "^8.6.0"
Copy link
Member

@SukkaW SukkaW Sep 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are creating new presets, it is a good chance for us to add a few more presets. E.g. we could add https://www.npmjs.com/package/eslint-plugin-mocha since almost all Hexo repos use mocha.

Note that we might need to disable a few rules (E.g. mocha/no-mocha-arrows since we all use arrow functions).

Copy link
Member

@uiolee uiolee Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need "type": "module", or name js file to mjs

Oops! Something went wrong! :(

ESLint: 9.11.1

/home/user/eslint-config-hexo/eslint.js:1
import nodePlugin from 'eslint-plugin-n';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)

Copy link
Member

@SukkaW SukkaW Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then keep using const = require then. In the ESLint world, CommonJS is still the first-class citizen.

eslint.js Outdated Show resolved Hide resolved
export default [
eslint,
...nodePlugin.configs["flat/mixed-esm-and-cjs"],
tslintConfig,

This comment was marked as off-topic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps fixed...

Copy link
Member

@uiolee uiolee Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I was wrong before and it might be okay.

But I don't know why not using tseslint.configs.recommended
https://typescript-eslint.io/users/configs/#getting-started

ts-test.js Outdated Show resolved Hide resolved

const tslintConfig = tseslint.config({
languageOptions: {
parser: tseslint.parser,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tslintconfig will not work on ts

ts
ts

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

Successfully merging this pull request may close these issues.

3 participants