@@ -43,7 +43,7 @@ Detected ESLint rules are mapped to Code PushUp audits. Audit reports are calcul
4343
44444 . Add this plugin to the ` plugins ` array in your Code PushUp CLI config file (e.g. ` code-pushup.config.js ` ).
4545
46- Pass in the path to your ESLint config file, along with glob patterns for which files you wish to target (relative to ` process.cwd() ` ).
46+ The simplest configuration uses default settings and lints the current directory:
4747
4848 ``` js
4949 import eslintPlugin from ' @code-pushup/eslint-plugin' ;
@@ -52,7 +52,21 @@ Detected ESLint rules are mapped to Code PushUp audits. Audit reports are calcul
5252 // ...
5353 plugins: [
5454 // ...
55- await eslintPlugin ({ eslintrc: ' .eslintrc.js' , patterns: [' src/**/*.js' ] }),
55+ await eslintPlugin (),
56+ ],
57+ };
58+ ```
59+
60+ You can optionally specify a custom ESLint config file and/or glob patterns for target files (relative to ` process.cwd() ` ):
61+
62+ ``` js
63+ import eslintPlugin from ' @code-pushup/eslint-plugin' ;
64+
65+ export default {
66+ // ...
67+ plugins: [
68+ // ...
69+ await eslintPlugin ({ eslintrc: ' ./eslint.config.js' , patterns: [' src/**/*.js' ] }),
5670 ],
5771 };
5872 ```
@@ -105,7 +119,7 @@ export default {
105119 plugins: [
106120 // ...
107121 await eslintPlugin(
108- { eslintrc: ' . eslintrc .js ' , patterns: [' src/* */ * .js ' ] },
122+ { eslintrc: ' eslint . config .js ' , patterns: [' src/* */ * .js ' ] },
109123 {
110124 groups: [
111125 {
@@ -239,19 +253,13 @@ The artifacts feature supports loading ESLint JSON reports that follow the stand
239253
240254### Basic artifact configuration
241255
242- Specify the path(s) to your ESLint JSON report files:
256+ Specify the path(s) to your ESLint JSON report files in the artifacts option. If you don ' t need custom lint patterns, pass an empty object as the first parameter :
243257
244258` ` ` js
245259import eslintPlugin from '@code-pushup/eslint-plugin';
246260
247261export default {
248- plugins: [
249- await eslintPlugin({
250- artifacts: {
251- artifactsPaths: ' ./ eslint- report .json ' ,
252- },
253- }),
254- ],
262+ plugins: [await eslintPlugin({}, { artifacts: { artifactsPaths: './eslint-report.json' } })],
255263};
256264` ` `
257265
@@ -262,11 +270,14 @@ Use glob patterns to aggregate results from multiple files:
262270` ` ` js
263271export default {
264272 plugins: [
265- await eslintPlugin({
266- artifacts: {
267- artifactsPaths: [' packages/* */ eslint- report .json ' , ' apps/* */ .eslint /* .json'],
273+ await eslintPlugin(
274+ {},
275+ {
276+ artifacts: {
277+ artifactsPaths: ['packages/**/eslint-report.json', 'apps/**/.eslint/*.json'],
278+ },
268279 },
269- } ),
280+ ),
270281 ],
271282};
272283` ` `
@@ -278,12 +289,15 @@ If you need to generate the artifacts before loading them, use the `generateArti
278289` ` ` js
279290export default {
280291 plugins: [
281- await eslintPlugin({
282- artifacts: {
283- generateArtifactsCommand: 'npm run lint:report',
284- artifactsPaths: './eslint-report.json',
292+ await eslintPlugin(
293+ {},
294+ {
295+ artifacts: {
296+ generateArtifactsCommand: 'npm run lint:report',
297+ artifactsPaths: './eslint-report.json',
298+ },
285299 },
286- } ),
300+ ),
287301 ],
288302};
289303` ` `
@@ -293,15 +307,18 @@ You can also specify the command with arguments:
293307` ` ` js
294308export default {
295309 plugins: [
296- await eslintPlugin({
297- artifacts: {
298- generateArtifactsCommand: {
299- command: 'eslint',
300- args: ['src/**/ * .{js,ts}' , ' -- format= json' , ' -- output- file= eslint- report .json ' ],
310+ await eslintPlugin(
311+ {},
312+ {
313+ artifacts: {
314+ generateArtifactsCommand: {
315+ command: 'eslint',
316+ args: ['src/**/*.{js,ts}', '--format=json', '--output-file=eslint-report.json'],
317+ },
318+ artifactsPaths: './eslint-report.json',
301319 },
302- artifactsPaths: ' ./ eslint- report .json ' ,
303320 },
304- } ),
321+ ),
305322 ],
306323};
307324` ` `
0 commit comments