Skip to content

Commit

Permalink
chore: migrate ESLint config
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerlox committed Jan 9, 2025
1 parent 4bfb9f6 commit 91f30f4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 24 deletions.
23 changes: 0 additions & 23 deletions .eslintrc.cjs

This file was deleted.

46 changes: 46 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import js from '@eslint/js';
import prettierConfig from 'eslint-plugin-prettier/recommended';
import jestPlugin from 'eslint-plugin-jest';
import globals from 'globals';

export default [
{
files: ['**/*.js'],
},
{
// Ignore patterns
ignores: ['coverage/**'],
},
js.configs.recommended,
prettierConfig,
{
// Base settings
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.node,
...globals.es6,
},
},
rules: {
'prettier/prettier': 'warn',
},
},
{
// Jest settings for test files
files: ['**/*.test.js'],
languageOptions: {
globals: {
...globals.jest,
},
},
plugins: {
jest: jestPlugin,
},
rules: {
...jestPlugin.configs.recommended.rules,
...jestPlugin.configs.style.rules,
},
},
];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"type": "module",
"scripts": {
"lint:eslint": "eslint . --ext .js",
"lint:eslint": "eslint .",
"lint:prettier": "prettier ./**/*.{json,md,yml} --check",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:fix": "npm run lint:eslint -- --fix && npm run lint:prettier -- --write",
Expand Down

0 comments on commit 91f30f4

Please sign in to comment.