generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIRA: CPOUI5FOUNDATION-885 --------- Co-authored-by: Merlin Beutlberger <[email protected]>
- Loading branch information
1 parent
dd2e5a9
commit 626f022
Showing
20 changed files
with
2,783 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,6 @@ jobs: | |
|
||
- name: Send report to Coveralls for package @ui5/linter | ||
uses: coverallsapp/[email protected] | ||
|
||
- name: Run e2e tests | ||
run: npm run e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import defaultAvaConfig from "./ava.config.js"; | ||
|
||
defaultAvaConfig.files = ["test/e2e/**/*.ts"]; | ||
|
||
export default defaultAvaConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import {lintProject} from "./linter/linter.js"; | ||
import type {LintResult} from "./linter/LinterContext.js"; | ||
|
||
export type {LintResult} from "./linter/LinterContext.js"; | ||
|
||
// Define a separate interface for the Node API as there could be some differences | ||
// in the options and behavior compared to LinterOptions internal type. | ||
export interface UI5LinterOptions { | ||
/** | ||
* List of patterns to lint. | ||
*/ | ||
filePatterns?: string[]; | ||
/** | ||
* Pattern/files that will be ignored during linting. | ||
*/ | ||
ignorePatterns?: string[]; | ||
/** | ||
* Provides complementary information for each finding, if available | ||
* @default false | ||
*/ | ||
details?: boolean; | ||
/** | ||
* Path to a ui5lint.config.(cjs|mjs|js) file | ||
*/ | ||
config?: string; | ||
/** | ||
* Whether to skip loading of the ui5lint.config.(cjs|mjs|js) config file | ||
* @default false | ||
*/ | ||
noConfig?: boolean; | ||
/** | ||
* Whether to provide a coverage report | ||
* @default false | ||
*/ | ||
coverage?: boolean; | ||
/** | ||
* Path to a ui5.yaml file or an object representation of ui5.yaml | ||
* @default "./ui5.yaml" | ||
*/ | ||
ui5Config?: string | object; | ||
/** | ||
* Root directory of the project | ||
* @default process.cwd() | ||
*/ | ||
rootDir?: string; | ||
} | ||
|
||
export async function ui5lint(options?: UI5LinterOptions): Promise<LintResult[]> { | ||
const { | ||
filePatterns, | ||
ignorePatterns = [], | ||
details = false, | ||
config, | ||
noConfig, | ||
coverage = false, | ||
ui5Config = "./ui5.yaml", | ||
rootDir = process.cwd(), | ||
} = options ?? {}; | ||
|
||
return lintProject({ | ||
rootDir, | ||
filePatterns, | ||
ignorePatterns, | ||
coverage, | ||
details, | ||
configPath: config, | ||
noConfig, | ||
ui5Config, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import test from "ava"; | ||
import {createRequire} from "node:module"; | ||
|
||
// Using CommonsJS require since JSON module imports are still experimental | ||
const require = createRequire(import.meta.url); | ||
|
||
test.serial("Package exports: export of package.json", (t) => { | ||
t.truthy(require("@ui5/linter/package.json").version); | ||
}); | ||
|
||
// Check number of defined exports | ||
test.serial("Package exports: check number of exports", (t) => { | ||
const packageJson = require("@ui5/linter/package.json"); | ||
t.is(Object.keys(packageJson.exports).length, 2); | ||
}); | ||
|
||
// Public API contract (exported modules) | ||
test.serial("Package exports: @ui5/linter", async (t) => { | ||
const actual = await import("@ui5/linter"); | ||
const expected = await import("../../lib/index.js"); | ||
t.is(actual, expected, "Correct module exported"); | ||
}); |
Oops, something went wrong.