From fb6278ebda05b592af5f293671b343e2ade482ec Mon Sep 17 00:00:00 2001 From: Peter van der Woude Date: Mon, 25 Jun 2018 23:12:48 +1000 Subject: [PATCH] fix lint etc errors --- types/jotform-css.js/index.d.ts | 89 +++++++------------ types/jotform-css.js/jotform-css.js-tests.ts | 6 -- .../{ => test}/jotform-css.js-global-tests.ts | 0 .../{ => test}/jotform-css.js-module-tests.ts | 0 types/jotform-css.js/tsconfig.json | 5 +- 5 files changed, 36 insertions(+), 64 deletions(-) delete mode 100644 types/jotform-css.js/jotform-css.js-tests.ts rename types/jotform-css.js/{ => test}/jotform-css.js-global-tests.ts (100%) rename types/jotform-css.js/{ => test}/jotform-css.js-module-tests.ts (100%) diff --git a/types/jotform-css.js/index.d.ts b/types/jotform-css.js/index.d.ts index d24e4d5458..1a712868fb 100644 --- a/types/jotform-css.js/index.d.ts +++ b/types/jotform-css.js/index.d.ts @@ -1,17 +1,17 @@ -// Type definitions for jotform-css.js v1.0.1 +// Type definitions for jotform-css.js 1.0 // Project: https://github.com/jotform/css.js // Definitions by: Peter van der Woude // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare global { - const cssjs: CssJsConstructor + const cssjs: CssJsConstructor; } export interface CssJsConstructor { new (): CssJs; } -export const cssjs : CssJsConstructor; +export const cssjs: CssJsConstructor; export default cssjs; export interface CssJs { @@ -19,107 +19,86 @@ export interface CssJs { * Parses given css string, and returns css object * keys as selectors and values are css rules * eliminates all css comments before parsing - * @param {string} css string to be parsed - * @returns {CssJs} css object + * @param css string to be parsed + * @returns css object */ - parseCSS(css: string): CssJs + parseCSS(css: string): CssJs; /** * parses given string containing css directives - * @param {string} rules, css directive string eg color:white; font-size:18px; - * @returns {any[]} an array of objects containing ruleName:ruleValue pairs + * @param rules, css directive string eg color:white; font-size:18px; + * @returns an array of objects containing ruleName:ruleValue pairs */ - parseRules(rules: string): any[] + parseRules(rules: string): any[]; /** * returns the rule having given directive - * @param {string} rules - * @param {string} directive - * @param {string} value */ - findCorrespondingRule(rules: string, directive: string, value?: string): string | boolean + findCorrespondingRule(rules: string, directive: string, value?: string): string | boolean; /** * Finds styles that have given selector, compress them and returns them - * @param cssObject - * @param {string} selector - * @param {boolean} contains */ - findBySelector(cssObject: CssJs, selector: string, contains?: boolean) : CssJs + findBySelector(cssObject: CssJs, selector: string, contains?: boolean): CssJs; /** * deletes cssObjects having given selector, and returns new array - * @param {CssJs} cssObject - * @param {string} selector - * @returns {CssJs} */ - deleteBySelector(cssObject: CssJs, selector: string): CssJs + deleteBySelector(cssObject: CssJs, selector: string): CssJs; /** * Compresses given cssObjectArray and tries to minimize selector redundence - * @param {CssJs} cssObject - * @returns {CssJs} */ - compressCSS(cssObject: CssJs): CssJs + compressCSS(cssObject: CssJs): CssJs; /** - * @param {CssJs} css1 - * @param {CssJs} css2 - * @returns {boolean} diff css object contains changed values in css1 in regards to css2, false if same + * @returns diff css object contains changed values in css1 in regards to css2, false if same */ - cssDiff(css1: CssJs, css2: CssJs): boolean + cssDiff(css1: CssJs, css2: CssJs): boolean; /** - * @param {CssJs} cssObject target css object array - * @param {CssJs} newArray source array that will be pushed into cssObject parameter - * @param {boolean} reverse [optional], if given true, first parameter will be traversed on reversed order - effectively giving priority to the styles in newArray + * @param cssObject target css object array + * @param newArray source array that will be pushed into cssObject parameter + * @param reverse [optional], if given true, first parameter will be traversed on reversed order + * effectively giving priority to the styles in newArray */ - intelligentMerge(cssObject: CssJs, newArray: CssJs, reverse?: boolean) : void + intelligentMerge(cssObject: CssJs, newArray: CssJs, reverse?: boolean): void; /** * inserts new css objects into a bigger css object with same selectors grouped together - * @param {CssJs} cssObject array of bigger css object to be pushed into - * @param {CssJs} minimalObject single css object - * @param {boolean} reverse reverse [optional] default is false, if given, cssObject will be reversly traversed - resulting more priority in minimalObject's styles + * @param cssObject array of bigger css object to be pushed into + * @param minimalObject single css object + * @param reverse reverse [optional] default is false, if given, cssObject will be reversly traversed + * resulting more priority in minimalObject's styles */ - intelligentCSSPush(cssObject: CssJs, minimalObject: CssJs, reverse?: boolean) : void + intelligentCSSPush(cssObject: CssJs, minimalObject: CssJs, reverse?: boolean): void; /** * Filter outs rule objects whose type param equal to DELETED - * @param {string} rules array of rules + * @param rules array of rules */ - compactRules(rules: string[]): string[] + compactRules(rules: string[]): string[]; /** * Computes string for ace editor using this.css or given cssBase optional parameter - * @param {CssJs} parsedCss - * @param depth - * @returns {string} */ - getCSSForEditor(parsedCss: CssJs, depth?: number): string + getCSSForEditor(parsedCss: CssJs, depth?: number): string; /** * Given rules array, returns visually formatted css string to be used inside editor - * @param {string} rules - * @param {null} depth - * @returns {string} */ - getCSSOfRules(rules: string, depth?: null): string + getCSSOfRules(rules: string, depth?: null): string; /** * Given css string or objectArray, parses it and then for every selector, * prepends this.cssPreviewNamespace to prevent css collision issues - * @param {CssJs} parsedCss - * @param {string} prefix - * @returns {CssJs} object in which this css prepended + * @returns object in which this css prepended */ - applyNamespacing(parsedCss: CssJs | string, prefix: string): CssJs + applyNamespacing(parsedCss: CssJs | string, prefix: string): CssJs; /** - * @param {string} css the original css string to be stripped out of comments - * @returns {string} cleaned CSS containing no css comments + * @param css the original css string to be stripped out of comments + * @returns cleaned CSS containing no css comments */ - stripComments(css: string): string + stripComments(css: string): string; } diff --git a/types/jotform-css.js/jotform-css.js-tests.ts b/types/jotform-css.js/jotform-css.js-tests.ts deleted file mode 100644 index ad2b619a10..0000000000 --- a/types/jotform-css.js/jotform-css.js-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -// DefinitelyTyped scripts are forcing me to have this, I don't need or want this file -function addNamespace2(cssString: string): string { - const parser = new cssjs(); - const parsed = parser.applyNamespacing(cssString, "#id1"); - return parser.getCSSForEditor(parsed); -} diff --git a/types/jotform-css.js/jotform-css.js-global-tests.ts b/types/jotform-css.js/test/jotform-css.js-global-tests.ts similarity index 100% rename from types/jotform-css.js/jotform-css.js-global-tests.ts rename to types/jotform-css.js/test/jotform-css.js-global-tests.ts diff --git a/types/jotform-css.js/jotform-css.js-module-tests.ts b/types/jotform-css.js/test/jotform-css.js-module-tests.ts similarity index 100% rename from types/jotform-css.js/jotform-css.js-module-tests.ts rename to types/jotform-css.js/test/jotform-css.js-module-tests.ts diff --git a/types/jotform-css.js/tsconfig.json b/types/jotform-css.js/tsconfig.json index bae12b9a2c..948e34b5ce 100644 --- a/types/jotform-css.js/tsconfig.json +++ b/types/jotform-css.js/tsconfig.json @@ -18,8 +18,7 @@ }, "files": [ "index.d.ts", - "jotform-css.js-tests.ts", - "jotform-css.js-global-tests.ts", - "jotform-css.js-module-tests.ts" + "test/jotform-css.js-global-tests.ts", + "test/jotform-css.js-module-tests.ts" ] }