mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-] update library to use new js-api 3.0.0 (#4097)
This commit is contained in:
committed by
Eugenio Romano
parent
2acd1b4e26
commit
3ef7d3b7ea
@@ -17,6 +17,8 @@ Rule.metadata = {
|
||||
typescriptOnly: true,
|
||||
};
|
||||
Rule.FAILURE_STRING = 'The name of the File should not start with ADF Alfresco or Activiti prefix ';
|
||||
Rule.FAILURE_STRING_UNDERSCORE = 'The name of the File should not have _ in the name but you can use - prefer the kebab case';
|
||||
Rule.FAILURE_STRING_UPPERCASE = 'The name of the File should not start with uppercase';
|
||||
exports.Rule = Rule;
|
||||
class AdfFileName extends Lint.RuleWalker {
|
||||
visitSourceFile(node) {
|
||||
@@ -32,6 +34,15 @@ class AdfFileName extends Lint.RuleWalker {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING + fileName));
|
||||
super.visitSourceFile(node);
|
||||
}
|
||||
if (fileName.indexOf('_') >= 0) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING_UNDERSCORE + fileName));
|
||||
super.visitSourceFile(node);
|
||||
}
|
||||
|
||||
if (fileName[0] == fileName[0].toUpperCase()) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING_UPPERCASE + fileName));
|
||||
super.visitSourceFile(node);
|
||||
}
|
||||
}
|
||||
getFilename() {
|
||||
const filename = this.getSourceFile().fileName;
|
||||
|
@@ -15,6 +15,8 @@ export class Rule extends Lint.Rules.AbstractRule {
|
||||
};
|
||||
|
||||
public static FAILURE_STRING = 'The name of the File should not start with ADF Alfresco or Activiti prefix ';
|
||||
public static FAILURE_STRING_UNDERSCORE = 'The name of the File should not have _ in the name but you can use - ';
|
||||
public static FAILURE_STRING_UPPERCASE = 'The name of the File should not start with uppercase';
|
||||
|
||||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
||||
return this.applyWithWalker(new AdfFileName(sourceFile, this.getOptions()));
|
||||
@@ -36,10 +38,21 @@ class AdfFileName extends Lint.RuleWalker {
|
||||
return currentWhiteListName === fileName;
|
||||
});
|
||||
|
||||
console.log('error');
|
||||
if (filenameMatch && !isWhiteListName) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING + fileName));
|
||||
super.visitSourceFile(node);
|
||||
}
|
||||
|
||||
if (fileName.indexOf('-') >= 0) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING_UNDERSCORE + fileName));
|
||||
super.visitSourceFile(node);
|
||||
}
|
||||
|
||||
if (fileName[0] == fileName[0].toUpperCase()) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING_UPPERCASE + fileName));
|
||||
super.visitSourceFile(node);
|
||||
}
|
||||
}
|
||||
|
||||
private getFilename(): string {
|
||||
|
2
tools/tslint-rules/package-lock.json
generated
2
tools/tslint-rules/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "adf-tslint-rules",
|
||||
"version": "0.0.6",
|
||||
"version": "0.0.7",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "adf-tslint-rules",
|
||||
"description": "Custom Rules for the ADF project",
|
||||
"version": "0.0.6",
|
||||
"version": "0.0.7",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
|
Reference in New Issue
Block a user