aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinigami <[email protected]>2025-06-19 13:14:34 +0200
committerGitHub <[email protected]>2025-06-19 13:14:34 +0200
commitca58b0cd0317099588e01e82af706828c6c1d154 (patch)
tree5c8b0f59df14f2b188957631e2a9bb6317d5af95
parentb357ea007fd25de31bb49fa8ab0af2359020b31c (diff)
downloadfaker-ca58b0cd0317099588e01e82af706828c6c1d154.tar.xz
faker-ca58b0cd0317099588e01e82af706828c6c1d154.zip
infra: update eslint config (#3530)
-rw-r--r--eslint.config.ts15
-rw-r--r--test/modules/finance.spec.ts4
-rw-r--r--test/modules/image.spec.ts2
-rw-r--r--test/modules/internet.spec.ts9
4 files changed, 11 insertions, 19 deletions
diff --git a/eslint.config.ts b/eslint.config.ts
index fdc8a4d1..cc0fc72a 100644
--- a/eslint.config.ts
+++ b/eslint.config.ts
@@ -1,6 +1,6 @@
import { includeIgnoreFile } from '@eslint/compat';
import eslint from '@eslint/js';
-import stylistic from '@stylistic/eslint-plugin';
+import eslintPluginStylistic from '@stylistic/eslint-plugin';
import eslintPluginVitest from '@vitest/eslint-plugin';
import eslintPluginFileProgress from 'eslint-plugin-file-progress';
import eslintPluginJsdoc from 'eslint-plugin-jsdoc';
@@ -135,7 +135,7 @@ const config: ReturnType<typeof tseslint.config> = tseslint.config(
{
name: 'stylistic overrides',
plugins: {
- '@stylistic': stylistic,
+ '@stylistic': eslintPluginStylistic,
},
rules: {
'@stylistic/padding-line-between-statements': [
@@ -147,15 +147,15 @@ const config: ReturnType<typeof tseslint.config> = tseslint.config(
//#endregion
//#region unicorn
- eslintPluginUnicorn.configs['flat/recommended'],
+ eslintPluginUnicorn.configs.recommended,
{
name: 'unicorn overrides',
rules: {
'unicorn/import-style': 'off', // subjective & doesn't do anything for us
'unicorn/no-array-callback-reference': 'off', // reduces readability
'unicorn/no-nested-ternary': 'off', // incompatible with prettier
- 'unicorn/no-object-as-default-parameter': 'off', // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2199
'unicorn/no-null': 'off', // incompatible with TypeScript
+ 'unicorn/no-object-as-default-parameter': 'off', // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2199
'unicorn/no-zero-fractions': 'off', // deactivated to raise awareness of floating operations
'unicorn/number-literal-case': 'off', // incompatible with prettier
'unicorn/numeric-separators-style': 'off', // "magic numbers" may carry specific meaning
@@ -210,6 +210,11 @@ const config: ReturnType<typeof tseslint.config> = tseslint.config(
//#region prettier
eslintPluginPrettierRecommended,
+ {
+ rules: {
+ curly: ['error', 'all'], // https://github.com/prettier/eslint-config-prettier#curly
+ },
+ },
//#endregion
//#region file-progress
@@ -256,7 +261,7 @@ const config: ReturnType<typeof tseslint.config> = tseslint.config(
vitest: eslintPluginVitest,
},
rules: {
- 'deprecation/deprecation': 'off',
+ '@typescript-eslint/no-deprecated': 'off',
'@typescript-eslint/restrict-template-expressions': [
'error',
diff --git a/test/modules/finance.spec.ts b/test/modules/finance.spec.ts
index 82ea482e..69bcc3d1 100644
--- a/test/modules/finance.spec.ts
+++ b/test/modules/finance.spec.ts
@@ -159,7 +159,6 @@ describe('finance', () => {
describe('maskedNumber()', () => {
it('should return contain parenthesis, ellipsis and have a length of 4 by default', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const actual = faker.finance.maskedNumber();
expect(actual).toMatch(/\(\.{3}\d{4}\)/);
@@ -167,7 +166,7 @@ describe('finance', () => {
it('should set a default length', () => {
const expected = 4; // default account mask length
- // eslint-disable-next-line @typescript-eslint/no-deprecated
+
const mask = faker.finance.maskedNumber({
parens: false,
ellipsis: false,
@@ -182,7 +181,6 @@ describe('finance', () => {
it('should set a specified length', () => {
const expected = faker.number.int({ min: 1, max: 20 });
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const mask = faker.finance.maskedNumber({
length: expected,
parens: false,
diff --git a/test/modules/image.spec.ts b/test/modules/image.spec.ts
index 0d494cb4..501a7a76 100644
--- a/test/modules/image.spec.ts
+++ b/test/modules/image.spec.ts
@@ -139,7 +139,6 @@ describe('image', () => {
describe('avatarLegacy', () => {
it('should return a random avatar url from cloudflare-ipfs', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const actual = faker.image.avatarLegacy();
expect(actual).toBeTypeOf('string');
@@ -231,7 +230,6 @@ describe('image', () => {
describe('urlPlaceholder', () => {
it('should return a random image url from Placeholder', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const actual = faker.image.urlPlaceholder();
assertValidUrl(actual);
diff --git a/test/modules/internet.spec.ts b/test/modules/internet.spec.ts
index 45c51705..e690761b 100644
--- a/test/modules/internet.spec.ts
+++ b/test/modules/internet.spec.ts
@@ -383,7 +383,6 @@ describe('internet', () => {
describe('userName()', () => {
it('should return a random userName', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const userName = faker.internet.userName();
expect(userName).toBeTruthy();
@@ -392,7 +391,6 @@ describe('internet', () => {
});
it('should return a random userName with given firstName', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const userName = faker.internet.userName({ firstName: 'Aiden' });
expect(userName).toBeTruthy();
@@ -402,7 +400,6 @@ describe('internet', () => {
});
it('should return a random userName with given firstName and lastName', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const userName = faker.internet.userName({
firstName: 'Aiden',
lastName: 'Harann',
@@ -416,7 +413,6 @@ describe('internet', () => {
});
it('should strip accents', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const userName = faker.internet.userName({
firstName: 'Adèle',
lastName: 'Smith',
@@ -426,7 +422,6 @@ describe('internet', () => {
});
it('should transliterate Cyrillic', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const userName = faker.internet.userName({
firstName: 'Амос',
lastName: 'Васильев',
@@ -435,7 +430,6 @@ describe('internet', () => {
});
it('should provide a fallback for Chinese etc', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const userName = faker.internet.userName({
firstName: '大羽',
lastName: '陳',
@@ -444,7 +438,6 @@ describe('internet', () => {
});
it('should provide a fallback special unicode characters', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const userName = faker.internet.userName({
firstName: '🐼',
lastName: '❤️',
@@ -847,7 +840,6 @@ describe('internet', () => {
describe('color()', () => {
it('should return a random hex value', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const color = faker.internet.color();
expect(color).toBeTruthy();
@@ -856,7 +848,6 @@ describe('internet', () => {
});
it('should return a random hex value with given values', () => {
- // eslint-disable-next-line @typescript-eslint/no-deprecated
const color = faker.internet.color({
redBase: 100,
greenBase: 100,