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

chore(eslint): add unicorn/prefer-string-slice rule #2913

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module.exports = {
'unicorn/prefer-dom-node-append': 'error',
'unicorn/prefer-dom-node-dataset': 'error',
'unicorn/prefer-dom-node-remove': 'error',
'unicorn/prefer-string-slice': 'error',
'unicorn/no-negated-condition': 'error',
'unicorn/no-array-callback-reference': 'error',
'unicorn/no-array-method-this-argument': 'error',
Expand Down
2 changes: 1 addition & 1 deletion test/config/jest.image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const toMatchImageSnapshotWithRealSignature = toMatchImageSnapshot as (received:
function computeRelativePathFromReportToSnapshots(path: string): string {
path = path.replace(/\\/g, '/');
const searchedPart = 'build/test-report/e2e/'; // hard coded here, must be kept in sync with the e2e/jest.config.js
return './' + path.substring(path.indexOf(searchedPart) + searchedPart.length);
return './' + path.slice(Math.max(0, path.indexOf(searchedPart) + searchedPart.length));
}

// the processing is inspired from jest-image-snapshot, but the management using a class is specific to this implementation
Expand Down
2 changes: 1 addition & 1 deletion test/performance/bpmn.load.performance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ afterAll(async () => {
await metricsCollector.destroy().then(() => {
try {
const oldDataString = fs.readFileSync(performanceDataFilePath, 'utf8');
const oldData = JSON.parse(oldDataString.substring('const data = '.length, oldDataString.length)) as ChartData;
const oldData = JSON.parse(oldDataString.slice('const data = '.length, oldDataString.length)) as ChartData;
const data = {
zoom: oldData.zoom,
load: [...oldData.load, ...metricsArray],
Expand Down
2 changes: 1 addition & 1 deletion test/performance/bpmn.navigation.performance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ afterAll(async () => {
await metricsCollector.destroy().then(() => {
try {
const oldDataString = fs.readFileSync(performanceDataFilePath, 'utf8');
const oldData = JSON.parse(oldDataString.substring('const data = '.length, oldDataString.length)) as ChartData;
const oldData = JSON.parse(oldDataString.slice('const data = '.length, oldDataString.length)) as ChartData;
const data = {
zoom: [...oldData.zoom, ...metricsArray],
load: oldData.load,
Expand Down