@lipemat/js-boilerplate 10.4.2 → 10.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ const nodeArgs = scriptIndex > 0 ? args.slice( 0, scriptIndex ) : [];
18
18
 
19
19
  const TS_CONVERTED_SCRIPTS = [
20
20
  'test',
21
+ 'lint',
21
22
  ];
22
23
 
23
24
  switch ( script ) {
package/helpers/config.js CHANGED
@@ -173,7 +173,6 @@ const getDefaultBrowsersList = () => {
173
173
  * Adjust the browserslist to include our defaults.
174
174
  */
175
175
  function adjustBrowserslist( browserRules ) {
176
- browserRules.push( 'not and_uc 15.5' );
177
176
  browserRules.push( 'not op_mini all' );
178
177
  return browserRules;
179
178
  }
@@ -0,0 +1,43 @@
1
+ export interface PackageConfig {
2
+ author?: string;
3
+ brotliFiles: boolean;
4
+ certificates?: Certificates;
5
+ combinedJson: boolean;
6
+ css_folder: string;
7
+ dependencies: Dependencies;
8
+ description?: string;
9
+ devDependencies: Dependencies;
10
+ es6Modules?: string[];
11
+ jsPath: string;
12
+ license?: string;
13
+ name?: string;
14
+ packageDirectory: string;
15
+ packageManager?: string;
16
+ resolutions?: Dependencies;
17
+ scripts: Partial<Scripts>;
18
+ shortCssClasses: boolean;
19
+ url: string;
20
+ version?: string;
21
+ workingDirectory: string;
22
+ }
23
+
24
+ export interface Dependencies {
25
+ [ name: string ]: string;
26
+ }
27
+
28
+ export interface Certificates {
29
+ cert: string;
30
+ key: string;
31
+ }
32
+
33
+ export interface Scripts {
34
+ browserslist: string;
35
+ dist: string;
36
+ lint: string;
37
+ postinstall: string;
38
+ start: string;
39
+ test: string;
40
+ }
41
+
42
+ declare const packageConfig: PackageConfig;
43
+ export default packageConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "10.4.2",
3
+ "version": "10.5.1",
4
4
  "description": "Dependencies and scripts for a no config JavaScript app",
5
5
  "author": "Mat Lipe",
6
6
  "license": "MIT",
@@ -34,6 +34,7 @@
34
34
  "lipemat-js-boilerplate": "bin/lipemat-js-boilerplate.js"
35
35
  },
36
36
  "scripts": {
37
+ "browserslist": "lipemat-js-boilerplate browserslist",
37
38
  "test": "lipemat-js-boilerplate test"
38
39
  },
39
40
  "dependencies": {
@@ -56,7 +57,7 @@
56
57
  "clean-css": "^5.3.0",
57
58
  "clean-webpack-plugin": "^4.0.0",
58
59
  "compression-webpack-plugin": "^10.0.0",
59
- "core-js": "~3.31.1",
60
+ "core-js": "^3.33.1",
60
61
  "cross-spawn": "^6.0.5",
61
62
  "css-loader": "6.7.1",
62
63
  "fork-ts-checker-webpack-plugin": "^7.2.13",
@@ -94,5 +95,5 @@
94
95
  "memfs": "^3.5.3",
95
96
  "setimmediate": "^1.0.5"
96
97
  },
97
- "packageManager": "yarn@3.6.1"
98
+ "packageManager": "yarn@3.6.4"
98
99
  }
@@ -1,5 +1,17 @@
1
- const {ESLint} = require( 'eslint' );
2
- const packageConfig = require( '../helpers/package-config' );
1
+ import {ESLint} from 'eslint';
2
+
3
+ import packageConfig from '../helpers/package-config';
4
+
5
+ /**
6
+ * ESLint does not have a utility method for detecting if
7
+ * any error has occurred, nor does it set the exit code.
8
+ *
9
+ * We can use this function to determine if any error has
10
+ * occurred and set the exit code accordingly.
11
+ */
12
+ function errorOccurred( results: ESLint.LintResult[] ): boolean {
13
+ return results.some( result => result.errorCount > 0 || result.warningCount > 0 );
14
+ }
3
15
 
4
16
  /**
5
17
  * Use the public API to run the eslint commands.
@@ -10,10 +22,12 @@ const packageConfig = require( '../helpers/package-config' );
10
22
  // 1. Create an instance with the `fix` option.
11
23
  const eslint = new ESLint( {
12
24
  fix: true,
25
+ cache: true,
26
+ cacheStrategy: 'content',
13
27
  } );
14
28
 
15
29
  // 2. Lint files. This doesn't modify target files.
16
- const results = await eslint.lintFiles( [
30
+ const results: ESLint.LintResult[] = await eslint.lintFiles( [
17
31
  packageConfig.workingDirectory + '/src/**/*.{js,jsx,ts,tsx}',
18
32
  ] );
19
33
 
@@ -29,6 +43,8 @@ const packageConfig = require( '../helpers/package-config' );
29
43
  if ( '' === resultText ) {
30
44
  console.log( '>> Linted JS files without errors.' );
31
45
  console.log( '-----------------------------------' );
46
+ } else if ( errorOccurred( results ) ) {
47
+ process.exitCode = 1;
32
48
  }
33
49
  }() ).catch( error => {
34
50
  process.exitCode = 1;