Skip to content

Commit

Permalink
fix!: cjs build (for eslint 8) (#225)
Browse files Browse the repository at this point in the history
`index.cjs` output in `0.10.1`: `module.exports = index;`  

`index.cjs` output in `0.11.0`: `exports.default = index;`

Tested with `npm link` in another project

closes oxc-project/oxc#7124
  • Loading branch information
Sysix authored Nov 5, 2024
1 parent 83c5b04 commit e7d1ff5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ If you are using flat configuration (eslint >= 9.0), you can use the following c

```js
// eslint.config.js
import { buildFromOxlintConfigFile } from 'eslint-plugin-oxlint';
import oxlint from 'eslint-plugin-oxlint';
export default [
..., // other plugins
...buildFromOxlintConfigFile('./oxlint.json'),
...oxlint.buildFromOxlintConfigFile('./oxlint.json'),
];
```

Or build it by an `oxlint.json`-like object:

```js
// eslint.config.js
import { buildFromOxlintConfig } from 'eslint-plugin-oxlint';
import oxlint from 'eslint-plugin-oxlint';
export default [
..., // other plugins
...buildFromOxlintConfig({
...oxlint.buildFromOxlintConfig({
categories: {
correctness: 'warn'
},
Expand Down
4 changes: 2 additions & 2 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { buildFromOxlintConfigFile } from './src/index.js';
import oxlint from './src/index.js';
import unicorn from 'eslint-plugin-unicorn';
import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
Expand All @@ -12,5 +12,5 @@ export default [
unicorn.configs['flat/recommended'],
...tseslint.configs.recommended,
eslintConfigPrettier,
...buildFromOxlintConfigFile('oxlint.json'),
...oxlint.buildFromOxlintConfigFile('oxlint.json'),
];
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as ruleMapsByCategory from './rules-by-category.js';
import configByScope from './configs-by-scope.js';
import configByCategory from './configs-by-category.js';

export {
import {
buildFromOxlintConfig,
buildFromOxlintConfigFile,
} from './build-from-oxlint-config.js';
Expand Down Expand Up @@ -43,4 +43,6 @@ export default {
...configByScope,
...configByCategory,
},
buildFromOxlintConfig,
buildFromOxlintConfigFile,
};

0 comments on commit e7d1ff5

Please sign in to comment.