Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f93af1c

Browse files
committed
Enable Airbnb ESLint restricted syntax
"error: iterators/generators require regenerator-runtime, which is too heavyweight"
1 parent 627edee commit f93af1c

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

‎.eslintrc.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ module.exports = {
3939
'no-plusplus': 'off',
4040
'lines-between-class-members': 'off',
4141
'spaced-comment': 'off',
42-
'no-restricted-syntax': 'off',
4342
'no-lonely-if': 'off',
4443
'max-classes-per-file': 'off',
4544

‎packages/react-form-with-constraints-tools/src/DisplayFields.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,10 @@ export class FieldFeedback extends _FieldFeedback {
194194
// Hack: make FieldFeedback <span style="display: inline">
195195
// Also make Bootstrap 4 happy because it sets 'display: none', see https://github.com/twbs/bootstrap/blob/v4.1.2/scss/mixins/_forms.scss#L31
196196
const fieldFeedbackSpans = this.rootEl!.querySelectorAll<HTMLSpanElement>('[data-feedback]');
197-
for (const fieldFeedbackSpan of fieldFeedbackSpans) {
197+
fieldFeedbackSpans.forEach(fieldFeedbackSpan => {
198+
// eslint-disable-next-line no-param-reassign
198199
fieldFeedbackSpan.style.display = 'inline';
199-
}
200+
});
200201

201202
// Change Async parent style
202203
const li = this.rootEl!.closest('li.async');

‎packages/react-form-with-constraints/src/EventEmitter.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export class EventEmitter<ListenerReturnType = void> {
2020

2121
if (listeners !== undefined) {
2222
console.assert(listeners.length > 0, `No listener for event '${eventName}'`);
23-
for (const listener of listeners) {
23+
for (let i = 0; i < listeners.length; i++) {
24+
const listener = listeners[i];
25+
2426
// Why await? Two cases:
2527
// - listener does not return a Promise:
2628
// => await changes nothing: the next listener call happens when the current one is done

‎packages/react-form-with-constraints/src/FormWithConstraints.tsx‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export class FormWithConstraints
8181

8282
const inputs = this.normalizeInputs(...inputsOrNames);
8383

84-
for (const input of inputs) {
84+
for (let i = 0; i < inputs.length; i++) {
85+
const input = inputs[i];
8586
// eslint-disable-next-line no-await-in-loop
8687
const field = await this.validateField(forceValidateFields, new InputElement(input));
8788
if (field !== undefined) {
@@ -132,7 +133,8 @@ export class FormWithConstraints
132133
if (inputsOrNames.length === 0) {
133134
// [name] matches <input name="...">, <select name="...">, <button name="...">, ...
134135
// See [Convert JavaScript NodeList to Array?](https://stackoverflow.com/a/33822526/990356)
135-
inputs = [...this.form!.querySelectorAll<HTMLInputElement>('[name]')];
136+
// [...HTMLCollection] vs Array.from(HTMLCollection): the latter doesn't need downlevelIteration with IE
137+
inputs = Array.from(this.form!.querySelectorAll<HTMLInputElement>('[name]'));
136138

137139
// Remove elements without ValidityState, example:
138140
// <iframe src="https://www.google.com/recaptcha..." name="a-49ekipqfmwsv">
@@ -158,7 +160,9 @@ export class FormWithConstraints
158160
inputs = inputsOrNames.map(input => {
159161
if (typeof input === 'string') {
160162
const query = `[name="${input}"]`;
161-
const elements = [...this.form!.querySelectorAll<HTMLInputElement>(query)];
163+
164+
// [...HTMLCollection] vs Array.from(HTMLCollection): the latter doesn't need downlevelIteration with IE
165+
const elements = Array.from(this.form!.querySelectorAll<HTMLInputElement>(query));
162166

163167
// Checks
164168

@@ -204,7 +208,8 @@ export class FormWithConstraints
204208

205209
const inputs = this.normalizeInputs(...inputsOrNames);
206210

207-
for (const input of inputs) {
211+
for (let i = 0; i < inputs.length; i++) {
212+
const input = inputs[i];
208213
// eslint-disable-next-line no-await-in-loop
209214
const field = await this.resetField(new InputElement(input));
210215
if (field !== undefined) fields.push(field);

‎tsconfig.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
"esModuleInterop": false,
99
"resolveJsonModule": true,
1010
"isolatedModules": true,
11-
"noLib": false,
12-
"lib": ["dom", "dom.iterable", "esnext"],
1311

1412
"strict": true,
1513
"noUnusedLocals": true,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /