Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@favware/milky-tslint
Advanced tools
TypeScript linter Gulp plugin, based on gulp-tslint but updated for modernization
Project Status
Bundle Sizes
Social Media and Donations
TypeScript linter plugin for Gulp. Based on gulp-tslint by panuhorsmalahti
Gulp down that milk 🥛!
yarn add @favware/milky-tslint tslint
# npm install @favware/milky-tslint tslint
const tslint = require("tslint");
const ts = require('typescript');
const {milkyLint, milkyReport} = require("milky-tslint");
gulp.task("lint", () => {
const lintProgram = tslint.Linter.createProgram('./tsconfig.json', '.');
ts.getPreEmitDiagnostics(lintProgram);
return gulp.src(tsSource)
.pipe(milkyLint({
formatter: 'stylish',
program: lintProgram,
tslint: tslint,
fix: !!argv.fix,
}))
.pipe(milkyReport());
});
TSLint Type Checking will work if you first use the createProgram
function as shown above. You should do this inside the gulp task, otherwise it will get cached and not function in consecutive runs of the task.
tslint.json is attempted to be read from near the input file. It must be available or supplied directly through the options.
The format in which failures are outputted may be controlled by specifying a TSLint formatter.
The default formatter is stylish
and the supported formatters are at least:
For a full list of supported formatters please go to the TSLint core formatters documentation
Custom TSLint formatters may also be
used by specifying the formatter
and formattersDirectory
properties on the options passed to
milky-tslint
.
If there is at least one failure a PluginError is emitted after execution of the reporters:
[gulp] Error in plugin 'milky-tslint': Failed to lint: input.ts
You can prevent editing the error by setting emitError in report options to false.
gulp.task("lint-noerroremit", () => {
const lintProgram = tslint.Linter.createProgram('./tsconfig.json', '.');
ts.getPreEmitDiagnostics(lintProgram);
return gulp.src(tsSource)
.pipe(milkyLint({
formatter: 'stylish',
program: lintProgram,
tslint: tslint,
fix: !!argv.fix,
}))
.pipe(milkyReport({
emitError: false
}));
});
tslint.json can be supplied as a parameter by setting the configuration property.
gulp.task("tslint-json", () =>
gulp.src("input.ts")
.pipe(milkyLint({
configuration: {
rules: {
"class-name": true,
// ...
}
}
}))
.pipe(milkyReport.report())
);
You can also supply a file path to the configuration option, and the file name doesn't need to be tslint.json.
.pipe(milkyLint({
// contains rules in the tslint.json format
configuration: "source/settings.json"
}))
You can optionally specify a report limit in the .report options that will turn off reporting for files after the limit has been reached. If the limit is 0 or less, the limit is ignored, which is the default setting.
gulp.task("tslint", () =>
gulp.src(["input.ts",])
.pipe(milkyLint({
formatter: "prose"
}))
.pipe(milkyReport.report({
reportLimit: 2
}))
);
TSLint 5.0 introduced support for a "warning" severity for linting errors. By default, warnings cause milky-tslint
to emit an error to maintain backwards-compatibility with previous versions. To let the build succeed in the presence of warnings, use the allowWarnings
report option.
gulp.task("tslint", () =>
gulp.src("input.ts")
.pipe(milkyLint({
formatter: "prose"
}))
.pipe(milkyReport.report({
allowWarnings: true
}))
);
const tslintOptions = {
configuration: {},
fix: false,
formatter: 'stylish',
formattersDirectory: null,
rulesDirectory: null,
tslint: null,
program: null
};
const reportOptions = {
emitError: false,
reportLimit: 0,
summarizeFailureOutput: true,
allowWarnings: false
};
TSLint plugin for Gulp
Reporter for milky-tslint
TSLint plugin for Gulp
Kind: global function
Param | Description |
---|---|
pluginOptions | Options to pass to the plugin |
Reporter for milky-tslint
Kind: global function
Param | Description |
---|---|
options | Reporter options |
FAQs
TypeScript linter Gulp plugin, based on gulp-tslint but updated for modernization
The npm package @favware/milky-tslint receives a total of 3 weekly downloads. As such, @favware/milky-tslint popularity was classified as not popular.
We found that @favware/milky-tslint demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.