Skip to content

Commit 7d149e1

Browse files
committed
chore(eslint): remove deprecated ESLint configuration files and update devDependencies
1 parent 301998c commit 7d149e1

File tree

7 files changed

+66
-65
lines changed

7 files changed

+66
-65
lines changed

.eslintignore

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

.eslintrc.json

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

eslint.config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from '@typescript-eslint/eslint-plugin';
3+
import tsParser from '@typescript-eslint/parser';
4+
import prettier from 'eslint-plugin-prettier';
5+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
6+
7+
export default [
8+
{
9+
ignores: ['dist/**', 'coverage/**', 'node_modules/**']
10+
},
11+
eslint.configs.recommended,
12+
{
13+
files: ['**/*.ts', '**/*.tsx'],
14+
languageOptions: {
15+
parser: tsParser,
16+
parserOptions: {
17+
ecmaVersion: 2020,
18+
sourceType: 'module'
19+
},
20+
globals: {
21+
console: 'readonly'
22+
}
23+
},
24+
plugins: {
25+
'@typescript-eslint': tseslint,
26+
'simple-import-sort': simpleImportSort,
27+
'prettier': prettier
28+
},
29+
rules: {
30+
'prettier/prettier': 'error',
31+
'no-unused-vars': 'off',
32+
'@typescript-eslint/no-unused-vars': ['error', {
33+
'argsIgnorePattern': '^_',
34+
'varsIgnorePattern': '^_',
35+
'ignoreRestSiblings': true,
36+
'args': 'none'
37+
}],
38+
'simple-import-sort/imports': 'error',
39+
'simple-import-sort/exports': 'error',
40+
'@typescript-eslint/no-var-requires': 'off'
41+
}
42+
}
43+
];

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"typescript": "5.5.3"
5050
},
5151
"devDependencies": {
52+
"@eslint/js": "^9.24.0",
5253
"@formatjs/intl-durationformat": "^0.7.4",
5354
"@jest/globals": "29.7.0",
5455
"@types/jest": "29.5.14",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* eslint-disable @typescript-eslint/ban-ts-comment */
2-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
3-
/* eslint-disable @typescript-eslint/no-explicit-any */
4-
51
import rosetta from 'rosetta';
62

73
type BreakDownObject<O, R = void> = {
@@ -62,10 +58,7 @@ export interface RosettyReturn<T> {
6258
str2: string,
6359
options?: Intl.CollatorOptions
6460
) => number;
65-
segmenter: (
66-
input: string,
67-
options?: Intl.SegmenterOptions
68-
) => Intl.Segments
61+
segmenter: (input: string, options?: Intl.SegmenterOptions) => Intl.Segments;
6962
//TODO : To replace https://github.com/microsoft/TypeScript/issues/60608
7063
durationFormat: (
7164
duration: {
@@ -147,8 +140,6 @@ export const rosetty = <T>(
147140
: actualConfig!.locale.toString();
148141
};
149142

150-
151-
152143
if (defaultLang) {
153144
changeLang(defaultLang);
154145
}
@@ -180,35 +171,32 @@ export const rosetty = <T>(
180171
},
181172
//Intl Polyfill
182173
displayNames: (langCode: string, options: Intl.DisplayNamesOptions) => {
183-
return new Intl.DisplayNames(
184-
[getLocale()],
185-
options
186-
).of(langCode);
174+
return new Intl.DisplayNames([getLocale()], options).of(langCode);
187175
},
188176
listFormat: (list: string[], options: Intl.ListFormatOptions) => {
189-
return new Intl.ListFormat(getLocale(), options).format(
190-
list
191-
);
177+
return new Intl.ListFormat(getLocale(), options).format(list);
192178
},
193179
numberFormat: (value: number, options: Intl.NumberFormatOptions) => {
194-
return new Intl.NumberFormat(getLocale(), options).format(
195-
value
196-
);
180+
return new Intl.NumberFormat(getLocale(), options).format(value);
197181
},
198182
pluralRules: (value: number, options: Intl.PluralRulesOptions) => {
199-
return new Intl.PluralRules(getLocale(), options).select(
200-
value
201-
);
183+
return new Intl.PluralRules(getLocale(), options).select(value);
202184
},
203-
dateTimeFormat: (value: number | Date, options?: Intl.DateTimeFormatOptions) => {
185+
dateTimeFormat: (
186+
value: number | Date,
187+
options?: Intl.DateTimeFormatOptions
188+
) => {
204189
return new Intl.DateTimeFormat(getLocale(), options).format(value);
205190
},
206191
relativeTimeFormat: (
207192
value: number,
208193
unit: Intl.RelativeTimeFormatUnit,
209194
options?: Intl.RelativeTimeFormatOptions
210195
) => {
211-
return new Intl.RelativeTimeFormat(getLocale(), options).format(value, unit);
196+
return new Intl.RelativeTimeFormat(getLocale(), options).format(
197+
value,
198+
unit
199+
);
212200
},
213201
collator: (str1: string, str2: string, options?: Intl.CollatorOptions) => {
214202
return new Intl.Collator(getLocale(), options).compare(str1, str2);

test/rosetty.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* eslint-disable @typescript-eslint/ban-ts-comment */
2-
import { describe, expect, it } from '@jest/globals';
31
import '@formatjs/intl-durationformat/polyfill';
42

3+
import { describe, expect, it } from '@jest/globals';
4+
55
import { rosetty } from '../src';
66

77
describe('rosetty', () => {
@@ -243,9 +243,9 @@ describe('Intl methods', () => {
243243
it('should format durations', () => {
244244
const duration = {
245245
hours: 2,
246-
minutes: 30
246+
minutes: 30,
247247
};
248-
248+
249249
expect(r.durationFormat(duration)).toMatch(/2.*30/);
250250
});
251251
});

0 commit comments

Comments
 (0)