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

eslintによる自動修正 #818

Merged
merged 1 commit into from
Oct 24, 2024
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
10 changes: 5 additions & 5 deletions src/interpreter/primitive-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
split: (target: VStr): VFn => FN_NATIVE(async ([splitter], _opts) => {
if (splitter) assertString(splitter);
if (splitter) {
return ARR(target.value.split(splitter ? splitter.value : '').map(s => STR(s)));

Check warning on line 93 in src/interpreter/primitive-props.ts

View workflow job for this annotation

GitHub Actions / lint

Unnecessary conditional, value is always truthy
} else {
return ARR(toArray(target.value).map(s => STR(s)));
}
Expand Down Expand Up @@ -312,7 +312,7 @@
return target;
}),

fill: (target: VArr): VFn => FN_NATIVE(async ([val, st, ed], opts) => {

Check warning on line 315 in src/interpreter/primitive-props.ts

View workflow job for this annotation

GitHub Actions / lint

'opts' is defined but never used. Allowed unused args must match /^_/u
const value = val ?? NULL;
const start = st && (assertNumber(st), st.value);
const end = ed && (assertNumber(ed), ed.value);
Expand All @@ -320,7 +320,7 @@
return target;
}),

repeat: (target: VArr): VFn => FN_NATIVE(async ([times], opts) => {

Check warning on line 323 in src/interpreter/primitive-props.ts

View workflow job for this annotation

GitHub Actions / lint

'opts' is defined but never used. Allowed unused args must match /^_/u
assertNumber(times);
try {
return ARR(Array(times.value).fill(target.value).flat());
Expand All @@ -331,15 +331,15 @@
}
}),

splice: (target: VArr): VFn => FN_NATIVE(async ([idx, rc, vs], opts) => {

Check warning on line 334 in src/interpreter/primitive-props.ts

View workflow job for this annotation

GitHub Actions / lint

'opts' is defined but never used. Allowed unused args must match /^_/u
assertNumber(idx);
const index = (idx.value < -target.value.length) ? 0
: (idx.value < 0) ? target.value.length + idx.value
: (idx.value >= target.value.length) ? target.value.length
: idx.value;
: (idx.value < 0) ? target.value.length + idx.value
: (idx.value >= target.value.length) ? target.value.length
: idx.value;

const remove_count = (rc != null) ? (assertNumber(rc), rc.value)
: target.value.length - index;
: target.value.length - index;

const items = (vs != null) ? (assertArray(vs), vs.value) : [];

Expand All @@ -347,7 +347,7 @@
return ARR(result);
}),

flat: (target: VArr): VFn => FN_NATIVE(async ([depth], opts) => {

Check warning on line 350 in src/interpreter/primitive-props.ts

View workflow job for this annotation

GitHub Actions / lint

'opts' is defined but never used. Allowed unused args must match /^_/u
depth = depth ?? NUM(1);
assertNumber(depth);
if (!Number.isInteger(depth.value)) throw new AiScriptRuntimeError('arr.flat expected integer, got non-integer');
Expand Down Expand Up @@ -378,7 +378,7 @@
});
const mapped_vals = await Promise.all(vals);
return ARR(mapped_vals.flat());
}),
}),

every: (target: VArr): VFn => FN_NATIVE(async ([fn], opts) => {
assertFunction(fn);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/random/genrng.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import seedrandom from 'seedrandom';
import { FN_NATIVE, NULL, NUM } from '../../interpreter/value.js';
import { textEncoder } from '../../const.js';
import { SeedRandomWrapper } from './seedrandom.js';
import { ChaCha20 } from './chacha20.js';
import type { VNativeFn, VNull, Value } from '../../interpreter/value.js';
import { textEncoder } from '../../const.js';

export function GenerateLegacyRandom(seed: Value | undefined) : VNativeFn | VNull {
if (!seed || seed.type !== 'num' && seed.type !== 'str') return NULL;
Expand Down
Loading