Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra: error on deprecation #1867

Merged
merged 5 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ module.exports = defineConfig({
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: false,
},
plugins: ['@typescript-eslint', 'prettier'],
plugins: ['@typescript-eslint', 'prettier', 'deprecation'],
rules: {
// We may want to use this in the future
'no-useless-escape': 'off',
'deprecation/deprecation': 'error',
eqeqeq: ['error', 'always', { null: 'ignore' }],
'prefer-template': 'error',

'@typescript-eslint/array-type': [
'error',
{ default: 'array-simple', readonly: 'generic' },
Expand Down Expand Up @@ -88,6 +88,7 @@ module.exports = defineConfig({
{
files: ['test/*.spec.ts'],
rules: {
'deprecation/deprecation': 'off',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"eslint-config-prettier": "~8.6.0",
"eslint-define-config": "~1.15.0",
"eslint-gitignore": "~0.1.0",
"eslint-plugin-deprecation": "~1.3.3",
"eslint-plugin-jsdoc": "~40.0.0",
"eslint-plugin-prettier": "~4.2.1",
"glob": "~8.1.0",
Expand Down
92 changes: 92 additions & 0 deletions pnpm-lock.yaml

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

2 changes: 2 additions & 0 deletions src/modules/company/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class CompanyModule {
until: '9.0',
});
// Don't want the source array exposed to modification, so return a copy
// eslint-disable-next-line deprecation/deprecation
return this.faker.definitions.company.suffix.slice(0);
}

Expand Down Expand Up @@ -74,6 +75,7 @@ export class CompanyModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.faker.helpers.arrayElement(this.suffixes());
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
19 changes: 19 additions & 0 deletions src/modules/image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ export class ImageModule {
/**
* @deprecated Use `faker.image` instead.
*/
// eslint-disable-next-line deprecation/deprecation
readonly unsplash: Unsplash;

/**
* @deprecated Use `faker.image` instead.
*/
// eslint-disable-next-line deprecation/deprecation
readonly lorempicsum: LoremPicsum;

/**
* @deprecated Use `faker.image.urlPlaceholder` instead.
*/
// eslint-disable-next-line deprecation/deprecation
readonly placeholder: Placeholder;

constructor(private readonly faker: Faker) {
Expand All @@ -38,8 +41,11 @@ export class ImageModule {
this[name].bind(this);
}

// eslint-disable-next-line deprecation/deprecation
this.unsplash = new Unsplash(this.faker);
// eslint-disable-next-line deprecation/deprecation
this.lorempicsum = new LoremPicsum(this.faker);
// eslint-disable-next-line deprecation/deprecation
this.placeholder = new Placeholder(this.faker);
}

Expand Down Expand Up @@ -501,6 +507,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'abstract', randomize);
}

Expand All @@ -527,6 +534,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'animals', randomize);
}

Expand All @@ -553,6 +561,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'business', randomize);
}

Expand All @@ -579,6 +588,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'cats', randomize);
}

Expand All @@ -605,6 +615,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'city', randomize);
}

Expand All @@ -631,6 +642,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'food', randomize);
}

Expand All @@ -657,6 +669,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'nightlife', randomize);
}

Expand All @@ -683,6 +696,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'fashion', randomize);
}

Expand All @@ -709,6 +723,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'people', randomize);
}

Expand All @@ -735,6 +750,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'nature', randomize);
}

Expand All @@ -761,6 +777,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'sports', randomize);
}

Expand All @@ -787,6 +804,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'technics', randomize);
}

Expand All @@ -813,6 +831,7 @@ export class ImageModule {
since: '8.0',
until: '9.0',
});
// eslint-disable-next-line deprecation/deprecation
return this.imageUrl(width, height, 'transport', randomize);
}
}
1 change: 1 addition & 0 deletions src/modules/image/providers/lorempicsum.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable deprecation/deprecation */
import type { Faker } from '../../..';
import { deprecated } from '../../../internal/deprecated';

Expand Down
1 change: 1 addition & 0 deletions src/modules/image/providers/placeholder.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable deprecation/deprecation */
import type { Faker } from '../../..';
import { deprecated } from '../../../internal/deprecated';

Expand Down
1 change: 1 addition & 0 deletions src/modules/image/providers/unsplash.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable deprecation/deprecation */
import type { Faker } from '../../..';
import { deprecated } from '../../../internal/deprecated';

Expand Down