Skip to content

Commit

Permalink
fix: use CommonJS instead of ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
atheck committed Nov 1, 2024
1 parent 24e08df commit 5ab43b9
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 46 deletions.
6 changes: 6 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"rules": {
"style": {
"useNamingConvention": "off"
},
"suspicious": {
"noRedundantUseStrict": "off"
},
"nursery": {
"noCommonJs": "off"
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions complexity.mjs → complexity.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// biome-ignore lint/style/noDefaultExport: Required for ESLint
export default [
"use strict";

module.exports = [
{
rules: {
"max-depth": ["warn", 2],
Expand Down
7 changes: 7 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use strict";

const complexity = require("./complexity.cjs");
const groupImports = require("./groupImports.cjs");
const nodeWithBiome = require("./nodeWithBiome.cjs");

module.exports = [...nodeWithBiome, ...complexity, ...groupImports];
6 changes: 0 additions & 6 deletions eslint.config.mjs

This file was deleted.

5 changes: 3 additions & 2 deletions groupImports.mjs → groupImports.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// biome-ignore lint/style/noDefaultExport: Required for ESLint
export default [
"use strict";

module.exports = [
{
rules: {
"sort-imports": [
Expand Down
27 changes: 14 additions & 13 deletions node.mjs → node.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import stylistic from "@stylistic/eslint-plugin";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import unicorn from "eslint-plugin-unicorn";
import importPlugin from "eslint-plugin-import";
import globals from "globals";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import jest from "eslint-plugin-jest";
import testingLibrary from "eslint-plugin-testing-library";
"use strict";

// biome-ignore lint/style/noDefaultExport: Required for ESLint
export default [
const stylistic = require("@stylistic/eslint-plugin");
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
const tsParser = require("@typescript-eslint/parser");
const importPlugin = require("eslint-plugin-import");
const jest = require("eslint-plugin-jest");
const react = require("eslint-plugin-react");
const reactHooks = require("eslint-plugin-react-hooks");
const testingLibrary = require("eslint-plugin-testing-library");
const unicorn = require("eslint-plugin-unicorn");
const globals = require("globals");

module.exports = [
{
plugins: {
"@stylistic": stylistic,
Expand Down Expand Up @@ -820,7 +821,7 @@ export default [
sourceType: "module",
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
tsconfigRootDir: __dirname,
},
},
rules: {
Expand Down
27 changes: 14 additions & 13 deletions nodeWithBiome.mjs → nodeWithBiome.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import stylistic from "@stylistic/eslint-plugin";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import unicorn from "eslint-plugin-unicorn";
import importPlugin from "eslint-plugin-import";
import globals from "globals";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import jest from "eslint-plugin-jest";
import testingLibrary from "eslint-plugin-testing-library";
"use strict";

// biome-ignore lint/style/noDefaultExport: Required for ESLint
export default [
const stylistic = require("@stylistic/eslint-plugin");
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
const tsParser = require("@typescript-eslint/parser");
const importPlugin = require("eslint-plugin-import");
const jest = require("eslint-plugin-jest");
const react = require("eslint-plugin-react");
const reactHooks = require("eslint-plugin-react-hooks");
const testingLibrary = require("eslint-plugin-testing-library");
const unicorn = require("eslint-plugin-unicorn");
const globals = require("globals");

module.exports = [
{
plugins: {
"@stylistic": stylistic,
Expand Down Expand Up @@ -735,7 +736,7 @@ export default [
sourceType: "module",
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
tsconfigRootDir: __dirname,
},
},
rules: {
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"main": "index.js",
"exports": {
"./biome": "./biomeLinting.json",
"./node": "./node.mjs",
"./nodeWithBiome": "./nodeWithBiome.mjs",
"./complexity": "./complexity.mjs",
"./groupImports": "./groupImports.mjs",
"./reactNative": "./reactNative.mjs"
"./node": "./node.cjs",
"./nodeWithBiome": "./nodeWithBiome.cjs",
"./complexity": "./complexity.cjs",
"./groupImports": "./groupImports.cjs",
"./reactNative": "./reactNative.cjs"
},
"scripts": {
"update": "npx -y npm-check-updates -i --install always",
Expand Down Expand Up @@ -55,4 +55,4 @@
"type": "git",
"url": "https://github.com/atheck/eslint-config-heck.git"
}
}
}
9 changes: 5 additions & 4 deletions reactNative.mjs → reactNative.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { fixupPluginRules } from "@eslint/compat";
import reactNative from "eslint-plugin-react-native";
"use strict";

// biome-ignore lint/style/noDefaultExport: Required for ESLint
export default [
const { fixupPluginRules } = require("@eslint/compat");
const reactNative = require("eslint-plugin-react-native");

module.exports = [
{
plugins: {
"react-native": fixupPluginRules(reactNative),
Expand Down

0 comments on commit 5ab43b9

Please sign in to comment.