Skip to content

Commit

Permalink
fix: esmodules for eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
gijslaarman committed Oct 16, 2024
1 parent e9a205f commit c0d6c40
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 108 deletions.
13 changes: 3 additions & 10 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import baseConfig from './eslint/base.mjs'
import typescriptConfig from './eslint/typescript.mjs'

export default [
{ extends: ['./eslint/_base.js'] },

{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
]
export default [...baseConfig, ...typescriptConfig]
39 changes: 0 additions & 39 deletions eslint/base.js

This file was deleted.

23 changes: 23 additions & 0 deletions eslint/base.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Base settings

import js from '@eslint/js'
import eslintConfigPrettier from 'eslint-config-prettier'
import importPlugin from 'eslint-plugin-import'

export default [
// Extend recommended rules
{
plugins: { import: importPlugin },
rules: {
...importPlugin.configs['recommended'].rules,
},
},
{
files: ['**/*.js'],
rules: {
...js.configs.recommended.rules,
'no-unused-vars': 'warn',
},
},
eslintConfigPrettier,
]
File renamed without changes.
29 changes: 0 additions & 29 deletions eslint/react.js

This file was deleted.

4 changes: 4 additions & 0 deletions eslint/react.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// react.js
import pluginReact from 'eslint-plugin-react'

export default [...pluginReact.configs.flat.all]
28 changes: 0 additions & 28 deletions eslint/typescript.js

This file was deleted.

5 changes: 5 additions & 0 deletions eslint/typescript.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Typescript

import tseslint from 'typescript-eslint'

export default [...tseslint.configs.recommended]
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
"license": "ISC",
"author": "Gijs Laarman",
"exports": {
"./eslint/*": "./eslint/*.js",
"./prettier": "./prettier/index.js",
"./eslint/*": {
"import": "./eslint/*.mjs"
},
"./prettier": {
"require": "./prettier/index.cjs"
},
"./typescript/node20": "./typescript/node20.tsconfig.json",
"./stylelint/*": "./stylelint/*.js"
},
Expand All @@ -31,6 +35,7 @@
"dependencies": {
"@typescript-eslint/eslint-plugin": "^8.9.0",
"@typescript-eslint/parser": "^8.9.0",
"@typescript-eslint/typescript-estree": "^8.9.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.6.3",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

File renamed without changes.

0 comments on commit c0d6c40

Please sign in to comment.