View Javadoc
1   /*
2    * SPDX-License-Identifier: LGPL-2.1-or-later
3    * See LICENSE file for details.
4    *
5    * Copyright 2012-2026 Hazendaz.
6    */
7   package net.alchim31.maven.yuicompressor;
8   
9   import java.io.IOException;
10  
11  import org.apache.maven.plugins.annotations.LifecyclePhase;
12  import org.apache.maven.plugins.annotations.Mojo;
13  
14  /**
15   * Check JS files with jslint.
16   */
17  @Mojo(name = "jslint", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresProject = true, threadSafe = true)
18  public class JSLintMojo extends MojoSupport {
19  
20      /** The jslint. */
21      private JSLintChecker jslint;
22  
23      @Override
24      protected String[] getDefaultIncludes() {
25          return new String[] { "**/**.js" };
26      }
27  
28      @Override
29      public void beforeProcess() throws IOException {
30          jslint = new JSLintChecker();
31      }
32  
33      @Override
34      public void afterProcess() {
35          // Do nothing
36      }
37  
38      @Override
39      protected void processFile(SourceFile src) throws IOException {
40          getLog().info("check file :" + src.toFile());
41          jslint.check(src.toFile(), jsErrorReporter);
42      }
43  }