tbonelee commented on code in PR #5071:
URL: https://github.com/apache/zeppelin/pull/5071#discussion_r2347184852
##########
zeppelin-web-angular/tslint.json:
##########
@@ -141,6 +141,7 @@
"variable-name": [true, "ban-keywords", "allow-leading-underscore"],
"whitespace": [true, "check-branch", "check-decl", "check-operator",
"check-separator", "check-type"],
"no-input-rename": true,
- "constructor-params-order": true
+ "constructor-params-order": true,
+ "orderedExports": [true, ["public-api.ts"]]
Review Comment:
I confirmed that camel case works, but we had better follow the conventions
in the [documentation](https://palantir.github.io/tslint/develop/custom-rules/)
(`Rule identifiers are always kebab-cased.`)
##########
zeppelin-web-angular/tslint-rules/orderedExportsRule.ts:
##########
@@ -0,0 +1,130 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import * as Lint from 'tslint';
+import * as ts from 'typescript';
+
+interface OptionsType {
+ targetFiles?: string[];
+}
+
+export class Rule extends Lint.Rules.AbstractRule {
+ public static FAILURE_STRING = 'Export statements should be alphabetically
ordered by module specifier';
+
+ public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
+ return this.applyWithFunction(sourceFile, walk, this.getOptions() as
OptionsType);
Review Comment:
`this.getOptions()` is returning `IOptions` type from `tslint` pacakage.
So we should remove type assertion or make a wrapping method that returns
`OptionsType`.
##########
zeppelin-web-angular/tslint-rules/orderedExportsRule.ts:
##########
@@ -0,0 +1,130 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import * as Lint from 'tslint';
+import * as ts from 'typescript';
+
+interface OptionsType {
+ targetFiles?: string[];
+}
+
+export class Rule extends Lint.Rules.AbstractRule {
+ public static FAILURE_STRING = 'Export statements should be alphabetically
ordered by module specifier';
+
+ public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
+ return this.applyWithFunction(sourceFile, walk, this.getOptions() as
OptionsType);
+ }
+}
+
+function walk(ctx: Lint.WalkContext<OptionsType>) {
Review Comment:
This generic argument should be modified if we change the above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]