gulp-lint-filepath
raw JSON → 1.0.1 verified Fri May 01 auth: no javascript maintenance
A Gulp plugin (v1.0.1) that lints file paths and names in a vinyl stream. It enforces naming conventions, allowed extensions, and directory index presence through customizable rules. Built-in rules include directory-index, directory-name, file-extension, and file-name – all disabled by default. The plugin supports custom rules and custom reporters. Last updated in 2015, it requires Node >=0.10 and has no recent maintenance. Unlike generic linters, it focuses solely on path conventions and integrates with Gulp pipelines.
Common errors
error TypeError: lintFilepath is not a function ↓
cause Default import not used correctly in ESM
fix
Use default import: import lintFilepath from 'gulp-lint-filepath'
error Error: Rule 'file-extension' requires an array ↓
cause Config provided as object instead of array for rule
fix
Make 'file-extension' an array of strings/regex, e.g., ['.js']
error TypeError: Cannot read property 'reporter' of undefined ↓
cause Reporter accessed before lintFilepath was loaded
fix
Ensure lintFilepath is required/imported first: const lintFilepath = require('gulp-lint-filepath')
Warnings
gotcha All rules are disabled by default. You must provide configuration to enable any linting. ↓
fix Pass a config object with rule keys and arrays/regexes.
deprecated Package is no longer maintained. Last update was in 2015. ↓
fix Consider alternatives like eslint-plugin-filenames or custom Gulp tasks with glob patterns.
gotcha The 'file-name' rule does not include the file extension in the check. ↓
fix Ensure your regex for file-name only matches the name without extension.
gotcha The 'directory-index' rule ignores directories with an 'ignore' array, not files. ↓
fix Provide directory paths or patterns in the ignore property for directory-index.
Install
npm install gulp-lint-filepath yarn add gulp-lint-filepath pnpm add gulp-lint-filepath Imports
- default wrong
const lintFilepath = require('gulp-lint-filepath')correctimport lintFilepath from 'gulp-lint-filepath' - reporter wrong
const reporter = require('gulp-lint-filepath').reportercorrectimport { reporter } from 'gulp-lint-filepath' - FilePath wrong
const FilePath = require('gulp-lint-filepath').FilePathcorrectimport { FilePath } from 'gulp-lint-filepath' - types
import type { LintConfig } from 'gulp-lint-filepath'
Quickstart
const gulp = require('gulp');
const lintFilepath = require('gulp-lint-filepath');
const config = {
'file-extension': ['.js', '.json'],
'file-name': [/^[a-z0-9.-]+$/],
'directory-name': [/^[a-z0-9-]+$/]
};
gulp.task('lint:paths', function() {
return gulp.src(['./**/*.*', '!./node_modules/**'])
.pipe(lintFilepath(config))
.pipe(lintFilepath.reporter());
});