Skip to content

Commit 9d49816

Browse files
committed
chore(lint): migrate to eslint's flag config
1 parent d14dad2 commit 9d49816

3 files changed

Lines changed: 50 additions & 34 deletions

File tree

.eslintrc.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

eslint.config.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
'use strict'
2+
3+
import stylistic from '@stylistic/eslint-plugin'
4+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
5+
import jest from 'eslint-plugin-jest'
6+
import love from 'eslint-config-love'
7+
8+
export default [
9+
{
10+
ignores: ['dist', '**/*.js']
11+
},
12+
// Stylistic
13+
{
14+
plugins: {
15+
'@stylistic': stylistic
16+
},
17+
rules: {
18+
'@stylistic/indent': ['error', 4],
19+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
20+
'@stylistic/space-before-function-paren': 'off',
21+
'@stylistic/no-unmodified-loop-condition': 'off'
22+
}
23+
},
24+
// eslint-config-love
25+
{
26+
...love
27+
},
28+
// Jest
29+
{
30+
files: ['test/**/*.test.ts', 'tests/**/*.test.ts', 'test/**/*.spec.ts', 'tests/**/*.spec.ts'],
31+
...jest.configs['flat/recommended'],
32+
rules: {
33+
...jest.configs['flat/recommended'].rules,
34+
...jest.configs['flat/style'].rules
35+
}
36+
},
37+
// Prettier
38+
eslintPluginPrettierRecommended,
39+
// Custom
40+
{
41+
rules: {
42+
'@typescript-eslint/no-magic-numbers': 'off',
43+
'jest/consistent-test-it': ['error', { fn: 'test' }]
44+
},
45+
files: ['tests/**.test.ts']
46+
}
47+
]

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@full-pack/string-pack",
33
"version": "0.8.0",
44
"description": "A lightweight and versatile String Utility Package for Node.js & Browser.",
5+
"type": "module",
56
"main": "./dist/index.js",
67
"module": "./dist/index.mjs",
78
"types": "./dist/index.d.ts",
@@ -30,8 +31,8 @@
3031
"coverage": "jest --coverage --config ./jest.config.ts",
3132
"format": "prettier -w .",
3233
"format:check": "prettier -c .",
33-
"lint": "eslint . --ext .ts",
34-
"lint:fix": "eslint --fix . --ext .ts"
34+
"lint": "eslint .",
35+
"lint:fix": "eslint --fix ."
3536
},
3637
"keywords": [
3738
"string",

0 commit comments

Comments
 (0)