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: migrate to FlatConfig #64

Merged
merged 17 commits into from
Jan 15, 2025
Prev Previous commit
Next Next commit
ESM to CommonJS
  • Loading branch information
yoshinorin committed Oct 30, 2024
commit eec30e99f6efa795ba5107c01faa3f189cfef28d
8 changes: 4 additions & 4 deletions eslint.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import nodePlugin from 'eslint-plugin-n';
import eslintJs from '@eslint/js';
import globals from 'globals';
const nodePlugin = require('eslint-plugin-n');
const eslintJs = require('@eslint/js');
const globals = require('globals');

const commonConfig = {
languageOptions: {
Expand Down Expand Up @@ -143,7 +143,7 @@ const commonConfig = {
},
};

export default [
module.exports = [
eslintJs.configs.recommended,
nodePlugin.configs["flat/recommended-script"],
commonConfig,
Expand Down
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import eslint from './eslint.js';
import globals from 'globals';
const eslint = require('./eslint.js');
Copy link
Member

Choose a reason for hiding this comment

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

Such naming may be confusing

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.
0544bdd

Personally, I think it would be better to rename the file itself from eslint.js. If we were to align it with other file names, it would be js.js, but I don't think that’s a good choice for naming.

const globals = require('globals');

const testConfig = {
languageOptions: {
Expand All @@ -12,7 +12,7 @@ const testConfig = {
},
};

export default [
module.exports = [
...eslint,
testConfig,
];
6 changes: 3 additions & 3 deletions ts-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tsJs from './ts.js';
import globals from 'globals';
const tsJs = require('./ts.js');
const globals = require('globals');

const tsTestConfig = {
languageOptions: {
Expand All @@ -12,7 +12,7 @@ const tsTestConfig = {
},
};

export default [
module.exports = [
...tsJs,
tsTestConfig,
];
8 changes: 4 additions & 4 deletions ts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tseslint from 'typescript-eslint';
import nodePlugin from 'eslint-plugin-n';
import eslint from './eslint.js';
const tseslint = require('typescript-eslint');
const nodePlugin = require('eslint-plugin-n');
const eslint = require('./eslint.js');

const nodeConfig = {
rules: {
Expand All @@ -9,7 +9,7 @@ const nodeConfig = {
},
}

export default [].concat(
module.exports = [].concat(
eslint,
nodePlugin.configs["flat/mixed-esm-and-cjs"],
...tseslint.configs.recommended,
Expand Down