{"_id":"@aptuitiv/gulp-eslint","name":"@aptuitiv/gulp-eslint","dist-tags":{"latest":"7.0.0"},"versions":{"7.0.0":{"name":"@aptuitiv/gulp-eslint","version":"7.0.0","description":"A gulp plugin for processing files with ESLint","repository":{"type":"git","url":"git+https://github.com/adametry/gulp-eslint.git"},"directories":{"example":"example","test":"test"},"scripts":{"pretest":"gulp","test":"mocha","gulp":"gulp","gulp-example":"gulp --gulpfile=example/config.js","coverage":"istanbul cover _mocha"},"keywords":["gulpplugin","eslint","gulp","errors","warnings","check","source","code","formatter","js","javascript","task","lint","plugin"],"author":{"name":"Adametry"},"contributors":[{"name":"Shinnosuke Watanabe","email":"snnskwtnb@gmail.com","url":"https://github.com/shinnn"},{"name":"Eric Tompkins at Aptuitiv","url":"https://github.com/aptuitiv"}],"license":"MIT","dependencies":{"eslint":"^8.0.0","fancy-log":"^2.0.0","plugin-error":"^2.0.1"},"devDependencies":{"@shinnn/eslint-config-node":"^5.0.0","babel-eslint":"^8.2.5","from2-string":"^1.1.0","gulp":"^4.0.2","istanbul":"^0.4.5","mocha":"^10.2.0","should":"^13.2.3","vinyl":"^3.0.0"},"gitHead":"cccd4503a093837c6ded5c81e31703b82316b072","bugs":{"url":"https://github.com/adametry/gulp-eslint/issues"},"homepage":"https://github.com/adametry/gulp-eslint#readme","_id":"@aptuitiv/gulp-eslint@7.0.0","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-9NkXsyI7USIwQaxfZzGpIC8bhbOjblPaHeCC/8zHMBrQ3ro9DOMyVnyG+BABJ8MZE4ABzl3zI3YZqJ3O2CLEKA==","shasum":"c4d0e32bed375710653e9182e1b5735a209785f9","tarball":"https://registry.npmjs.org/@aptuitiv/gulp-eslint/-/gulp-eslint-7.0.0.tgz","fileCount":5,"unpackedSize":25389,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDiV76D7smvsI6gS6x/6TW4XH6HBxzyCMLvezZYih28lwIhAIUijMgOnBurIFT9/tKLOBQ3CL17CT8qzTTt0+Y//wTo"}]},"_npmUser":{"name":"erictompkins","email":"eric@aptuitiv.com"},"maintainers":[{"name":"erictompkins","email":"eric@aptuitiv.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gulp-eslint_7.0.0_1706986714520_0.4922343459931924"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-03T18:58:34.459Z","7.0.0":"2024-02-03T18:58:34.707Z","modified":"2024-02-03T18:58:35.012Z"},"maintainers":[{"name":"erictompkins","email":"eric@aptuitiv.com"}],"description":"A gulp plugin for processing files with ESLint","homepage":"https://github.com/adametry/gulp-eslint#readme","keywords":["gulpplugin","eslint","gulp","errors","warnings","check","source","code","formatter","js","javascript","task","lint","plugin"],"repository":{"type":"git","url":"git+https://github.com/adametry/gulp-eslint.git"},"contributors":[{"name":"Shinnosuke Watanabe","email":"snnskwtnb@gmail.com","url":"https://github.com/shinnn"},{"name":"Eric Tompkins at Aptuitiv","url":"https://github.com/aptuitiv"}],"author":{"name":"Adametry"},"bugs":{"url":"https://github.com/adametry/gulp-eslint/issues"},"license":"MIT","readme":"# gulp-eslint [![Build Status](https://travis-ci.org/adametry/gulp-eslint.svg)](https://travis-ci.org/adametry/gulp-eslint) [![Coverage Status](https://img.shields.io/coveralls/adametry/gulp-eslint.svg)](https://coveralls.io/github/adametry/gulp-eslint)\n\nA [gulp](https://gulpjs.com/) plugin for [ESLint](https://eslint.org/)\n\n> **This is a fork by [Aptuitiv](https://www.aptuitiv.com) because the [original repository](github.com/adametry/gulp-eslint) is out of date.**\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).\n\n```bash\nnpm install gulp-eslint\n```\n\n## Usage\n\n```javascript\nconst { src, task } = require(\"gulp\");\nconst eslint = require(\"gulp-eslint\");\n\ntask(\"default\", () => {\n return (\n  src([\"scripts/*.js\"])\n   // eslint() attaches the lint output to the \"eslint\" property\n   // of the file object so it can be used by other modules.\n   .pipe(eslint())\n   // eslint.format() outputs the lint results to the console.\n   // Alternatively use eslint.formatEach() (see Docs).\n   .pipe(eslint.format())\n   // To have the process exit with an error code (1) on\n   // lint error, return the stream and pipe to failAfterError last.\n   .pipe(eslint.failAfterError())\n );\n});\n```\n\nOr use the plugin API to do things like:\n\n```javascript\ngulp.src([\"**/*.js\", \"!node_modules/**\"])\n .pipe(\n  eslint({\n   rules: {\n    \"my-custom-rule\": 1,\n    strict: 2,\n   },\n   globals: [\"jQuery\", \"$\"],\n   envs: [\"browser\"],\n  })\n )\n .pipe(eslint.formatEach(\"compact\", process.stderr));\n```\n\nFor additional examples, look through the [example directory](https://github.com/adametry/gulp-eslint/tree/master/example).\n\n## API\n\n### eslint()\n\n_No explicit configuration._ A `.eslintrc` file may be resolved relative to each linted file.\n\n### eslint(options)\n\nSee [ESlint CLIEngine options](https://eslint.org/docs/developer-guide/nodejs-api#cliengine).\n\n#### options.rules\n\nType: `Object`\n\nSet [configuration](https://eslint.org/docs/user-guide/configuring#configuring-rules) of [rules](https://eslint.org/docs/rules/).\n\n```javascript\n{\n \"rules\":{\n  \"camelcase\": 1,\n  \"comma-dangle\": 2,\n  \"quotes\": 0\n }\n}\n```\n\n#### options.globals\n\nType: `Array`\n\nSpecify global variables to declare.\n\n```javascript\n{\n \"globals\":[\n  \"jQuery\",\n  \"$\"\n ]\n}\n```\n\n#### options.fix\n\nType: `Boolean`\n\nThis option instructs ESLint to try to fix as many issues as possible. The fixes are applied to the gulp stream. The fixed content can be saved to file using `gulp.dest` (See [example/fix.js](https://github.com/adametry/gulp-eslint/blob/master/example/fix.js)). Rules that are fixable can be found in ESLint's [rules list](https://eslint.org/docs/rules/).\n\nWhen fixes are applied, a \"fixed\" property is set to `true` on the fixed file's ESLint result.\n\n#### options.quiet\n\nType: `Boolean`\n\nWhen `true`, this option will filter warning messages from ESLint results. This mimics the ESLint CLI [quiet option](https://eslint.org/docs/user-guide/command-line-interface#quiet).\n\nType: `function (message, index, list) { return Boolean(); }`\n\nWhen provided a function, it will be used to filter ESLint result messages, removing any messages that do not return a `true` (or truthy) value.\n\n#### options.envs\n\nType: `Array`\n\nSpecify a list of [environments](https://eslint.org/docs/user-guide/configuring#specifying-environments) to be applied.\n\n#### options.rulePaths\n\nType: `Array`\n\nThis option allows you to specify additional directories from which to load rules files. This is useful when you have custom rules that aren't suitable for being bundled with ESLint. This option works much like the ESLint CLI's [rulesdir option](https://eslint.org/docs/user-guide/command-line-interface#rulesdir).\n\n#### options.configFile\n\nType: `String`\n\nPath to the ESLint rules configuration file. For more information, see the ESLint CLI [config option](https://eslint.org/docs/user-guide/command-line-interface#c-config) and [Using Configuration Files](https://eslint.org/docs/user-guide/configuring#using-configuration-files).\n\n#### options.warnFileIgnored\n\nType: `Boolean`\n\nWhen `true`, add a result warning when ESLint ignores a file. This can be used to file files that are needlessly being loaded by `gulp.src`. For example, since ESLint automatically ignores \"node_modules\" file paths and gulp.src does not, a gulp task may take seconds longer just reading files from the \"node_modules\" directory.\n\n#### options.useEslintrc\n\nType: `Boolean`\n\nWhen `false`, ESLint will not load [.eslintrc files](https://eslint.org/docs/user-guide/configuring#using-configuration-files).\n\n### eslint(configFilePath)\n\nType: `String`\n\nShorthand for defining `options.configFile`.\n\n### eslint.result(action)\n\nType: `function (result) {}`\n\nCall a function for each ESLint file result. No returned value is expected. If an error is thrown, it will be wrapped in a Gulp PluginError and emitted from the stream.\n\n```javascript\ngulp.src([\"**/*.js\", \"!node_modules/**\"])\n .pipe(eslint())\n .pipe(\n  eslint.result((result) => {\n   // Called for each ESLint result.\n   console.log(`ESLint result: ${result.filePath}`);\n   console.log(`# Messages: ${result.messages.length}`);\n   console.log(`# Warnings: ${result.warningCount}`);\n   console.log(`# Errors: ${result.errorCount}`);\n  })\n );\n```\n\nType: `function (result, callback) { callback(error); }`\n\nCall an asynchronous function for each ESLint file result. The callback must be called for the stream to finish. If a value is passed to the callback, it will be wrapped in a Gulp PluginError and emitted from the stream.\n\n### eslint.results(action)\n\nType: `function (results) {}`\n\nCall a function once for all ESLint file results before a stream finishes. No returned value is expected. If an error is thrown, it will be wrapped in a Gulp PluginError and emitted from the stream.\n\nThe results list has a \"warningCount\" property that is the sum of warnings in all results; likewise, an \"errorCount\" property is set to the sum of errors in all results.\n\n```javascript\ngulp.src([\"**/*.js\", \"!node_modules/**\"])\n .pipe(eslint())\n .pipe(\n  eslint.results((results) => {\n   // Called once for all ESLint results.\n   console.log(`Total Results: ${results.length}`);\n   console.log(`Total Warnings: ${results.warningCount}`);\n   console.log(`Total Errors: ${results.errorCount}`);\n  })\n );\n```\n\nType: `function (results, callback) { callback(error); }`\n\nCall an asynchronous function once for all ESLint file results before a stream finishes. The callback must be called for the stream to finish. If a value is passed to the callback, it will be wrapped in a Gulp PluginError and emitted from the stream.\n\n### eslint.failOnError()\n\nStop a task/stream if an ESLint error has been reported for any file.\n\n```javascript\n// Cause the stream to stop(/fail) before copying an invalid JS file to the output directory\ngulp.src([\"**/*.js\", \"!node_modules/**\"])\n .pipe(eslint())\n .pipe(eslint.failOnError());\n```\n\n### eslint.failAfterError()\n\nStop a task/stream if an ESLint error has been reported for any file, but wait for all of them to be processed first.\n\n```javascript\n// Cause the stream to stop(/fail) when the stream ends if any ESLint error(s) occurred.\ngulp.src([\"**/*.js\", \"!node_modules/**\"])\n .pipe(eslint())\n .pipe(eslint.failAfterError());\n```\n\n### eslint.format(formatter, output)\n\nFormat all linted files once. This should be used in the stream after piping through `eslint`; otherwise, this will find no ESLint results to format.\n\nThe `formatter` argument may be a `String`, `Function`, or `undefined`. As a `String`, a formatter module by that name or path will be resolved as a module, relative to `process.cwd()`, or as one of the [ESLint-provided formatters](https://github.com/eslint/eslint/tree/master/lib/formatters). If `undefined`, the ESLint “stylish” formatter will be resolved. A `Function` will be called with an `Array` of file linting results to format.\n\n```javascript\n// use the default \"stylish\" ESLint formatter\neslint.format();\n\n// use the \"checkstyle\" ESLint formatter\neslint.format(\"checkstyle\");\n\n// use the \"eslint-path-formatter\" module formatter\n// (@see https://github.com/Bartvds/eslint-path-formatter)\neslint.format(\"node_modules/eslint-path-formatter\");\n```\n\nThe `output` argument may be a `WritableStream`, `Function`, or `undefined`. As a `WritableStream`, the formatter results will be written to the stream. If `undefined`, the formatter results will be written to [gulp’s log](https://github.com/gulpjs/gulp-util#logmsg). A `Function` will be called with the formatter results as the only parameter.\n\n```javascript\n// write to gulp's log (default)\neslint.format();\n\n// write messages to stdout\neslint.format(\"junit\", process.stdout);\n```\n\n### eslint.formatEach(formatter, output)\n\nFormat each linted file individually. This should be used in the stream after piping through `eslint`; otherwise, this will find no ESLint results to format.\n\nThe arguments for `formatEach` are the same as the arguments for `format`.\n\n## Configuration\n\nESLint may be configured explicity by using any of the following plugin options: `config`, `rules`, `globals`, or `env`. If the useEslintrc option is not set to `false`, ESLint will attempt to resolve a file by the name of `.eslintrc` within the same directory as the file to be linted. If not found there, parent directories will be searched until `.eslintrc` is found or the directory root is reached.\n\n## Ignore Files\n\nESLint will ignore files that do not have a `.js` file extension at the point of linting ([some plugins](https://github.com/contra/gulp-coffee) may change file extensions mid-stream). This avoids unintentional linting of non-JavaScript files.\n\nESLint will also detect an `.eslintignore` file at the cwd or a parent directory. See the [ESLint docs](https://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories) to learn how to construct this file.\n\n## Extensions\n\nESLint results are attached as an \"eslint\" property to the vinyl files that pass through a Gulp.js stream pipeline. This is available to streams that follow the initial `eslint` stream. The eslint.result and eslint.results methods are made available to support extensions and custom handling of ESLint results.\n\n### Gulp-Eslint Extensions\n\n- [gulp-eslint-if-fixed](https://github.com/lukeapage/gulp-eslint-if-fixed)\n- [gulp-eslint-threshold](https://github.com/krmbkt/gulp-eslint-threshold)\n","readmeFilename":"README.md"}