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 #394

Merged
merged 3 commits into from
May 17, 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.

26 changes: 0 additions & 26 deletions .eslintrc.yml

This file was deleted.

3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

### Changed

- Bump markdown-it to [v14.1.0](https://github.com/markdown-it/markdown-it/blob/master/CHANGELOG.md#1410---2024-03-19), and follow the latest spec of [CommonMark 0.31.2](https://spec.commonmark.org/0.31.2/) ([#393](https://github.com/marp-team/marpit/pull/393))
- Switch package manager from yarn to npm ([#391](https://github.com/marp-team/marpit/pull/391))
- Upgrade development Node.js to v20 LTS ([#392](https://github.com/marp-team/marpit/pull/392))
- Bump markdown-it to [v14.1.0](https://github.com/markdown-it/markdown-it/blob/master/CHANGELOG.md#1410---2024-03-19), and follow the latest spec of [CommonMark 0.31.2](https://spec.commonmark.org/0.31.2/) ([#393](https://github.com/marp-team/marpit/pull/393))
- Upgrade dependent packages to the latest version ([#393](https://github.com/marp-team/marpit/pull/393))
- Migrate ESLint config to Flat config ([#394](https://github.com/marp-team/marpit/pull/394))

### Removed

Expand Down
3 changes: 0 additions & 3 deletions docsify/.eslintrc.yml

This file was deleted.

67 changes: 67 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import babelParser from '@babel/eslint-parser'
import js from '@eslint/js'
import eslintConfigPrettier from 'eslint-config-prettier'
import eslintPluginImportX from 'eslint-plugin-import-x'
import globals from 'globals'

export default [
js.configs.recommended,
// eslintPluginImportX.configs.recommended, // not yet available
eslintConfigPrettier,
{
languageOptions: {
parser: babelParser,
globals: {
...globals.node,
},
},
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
plugins: {
import: eslintPluginImportX,
},
rules: {
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
},
},
],
'max-len': [
'error',
{
code: 80,
tabWidth: 2,
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
},
},
{
files: ['test/**/*', 'jest.*'],
languageOptions: {
globals: {
...globals.jest,
context: 'readonly',
},
},
},
{
ignores: [
'coverage/**/*',
'dist/**/*',
'docs/**/*',
'jsdoc/**/*',
'lib/**/*',
'node_modules/**/*',
'plugin.js',
],
},
]
1 change: 0 additions & 1 deletion jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/* eslint-env jest */
global.context = describe
30 changes: 26 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"docs:style": "node ./docsify/build.js",
"format": "prettier \"**/*.{css,html,js,json,md,scss,ts,yaml,yml}\"",
"jsdoc": "rimraf jsdoc && jsdoc src -c .jsdoc.json",
"lint:js": "ESLINT_USE_FLAT_CONFIG=false eslint --report-unused-disable-directives .",
"lint:js": "eslint",
"lint:css": "stylelint \"./**/*.{css,scss}\"",
"prepack": "npm-run-all --parallel check:* lint:* test:coverage --sequential build",
"preversion": "run-p check:* lint:* test:coverage",
Expand All @@ -73,6 +73,7 @@
"eslint": "^9.2.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import-x": "^0.5.0",
"globals": "^15.2.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"jsdoc": "^4.0.3",
Expand Down
1 change: 0 additions & 1 deletion src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* @returns {Function} Generated Marpit plugin.
*/
function marpitPlugin(plugin) {
// eslint-disable-next-line func-names
return function (md, ...args) {
if (md.marpit) return plugin.call(this, md, ...args)

Expand Down
1 change: 0 additions & 1 deletion src/postcss/import/parse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint consistent-return: 0 */
/** @module */
import postcssPlugin from '../../helpers/postcss_plugin'

Expand Down
5 changes: 0 additions & 5 deletions test/.eslintrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion test/plugin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import markdownIt from 'markdown-it'
import { Marpit } from '../src/index'
import pluginAsDefaultExport from '../src/plugin'
import { marpitPlugin } from '../src/plugin'
import { Marpit } from '../src/index'

describe('Plugin interface', () => {
it('is compatible as CommonJS module', () => {
Expand Down