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

Migrate ESLint config to Flat config #385

Merged
merged 3 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

42 changes: 0 additions & 42 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* Upgrade development Node.js to v20 LTS ([#359](https://github.com/marp-team/marp-core/pull/359))
* Upgrade dependent packages to the latest version ([#380](https://github.com/marp-team/marp-core/pull/380))
* Switch package manager from yarn to npm ([#379](https://github.com/marp-team/marp-core/pull/379))
* Migrate ESLint config to Flat config ([#385](https://github.com/marp-team/marp-core/pull/385))

### Fixed

Expand Down
60 changes: 60 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import js from '@eslint/js'
import eslintConfigPrettier from 'eslint-config-prettier'
import eslintPluginImportX from 'eslint-plugin-import-x'
import eslintPluginJest from 'eslint-plugin-jest'
import globals from 'globals'
import tseslint from 'typescript-eslint'

const tsFiles = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts']
const testFiles = ['test/**']
const forFiles = (files, confs) => confs.map((conf) => ({ ...conf, files }))

export default tseslint.config(
js.configs.recommended,
eslintPluginImportX.flatConfigs.recommended,
...forFiles(tsFiles, [
...tseslint.configs.recommended,
eslintPluginImportX.flatConfigs.typescript,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
]),
...forFiles(testFiles, [
eslintPluginJest.configs['flat/recommended'],
eslintPluginJest.configs['flat/style'],
]),
eslintConfigPrettier,
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
languageOptions: {
ecmaVersion: 'latest',
globals: {
...globals.node,
...globals.browser,
},
},
rules: {
'import-x/order': ['error', { alphabetize: { order: 'asc' } }],
},
settings: {
'import-x/resolver': 'typescript',
},
},
{
ignores: [
'browser.d.ts',
'coverage/**/*',
'lib/**/*',
'node_modules/**/*',
'sandbox/**/*',
'tmp/**/*',
'types/**/*',
],
},
)
Loading