@lipemat/js-boilerplate 10.6.0-beta.4 → 10.6.0
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.
- package/README.md +3 -8
- package/helpers/config.js +2 -0
- package/package.json +3 -1
- package/scripts/lint.ts +6 -2
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ Add the following to your package.json. (this may also be found in the `template
|
|
|
44
44
|
* `cssTsFiles : {bool}` Enable auto generation of TypeScript definitions for CSS modules.
|
|
45
45
|
|
|
46
46
|
## Code Completion In PHPStorm
|
|
47
|
-
Some `@types` have been specified in this library to
|
|
47
|
+
Some `@types` have been specified in this library to help with code completion and allow using the built-in TypeScript support. Unfortunately, some typescripts still send errors to PHPStorm like "Default export is not declared in an imported module". I've found that it's easier to just remove this warning by un-checking `Editor -> Inspections -> JavaScript -> General -> Validate Imports`. (this may not need to be un-checked if you enable the built-in TypeScript support).
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
## ESLint
|
|
@@ -72,7 +72,7 @@ The console will display a list of browsers targeted by your [browserslist confi
|
|
|
72
72
|
To use the built-in TypeScript, copy the following items from `templates` into your project root:
|
|
73
73
|
1. `tsconfig.json`
|
|
74
74
|
|
|
75
|
-
TypeScript will run a validator during dev and output any errors in the console. These same errors will display within PHPStorm if you copied tsconfig.json file in step 1. You technically don't have to fix any issues to compile but it's recommended.
|
|
75
|
+
TypeScript will run a validator during dev and output any errors in the console. These same errors will display within PHPStorm if you copied tsconfig.json file in step 1. You technically don't have to fix any issues to compile, but it's recommended.
|
|
76
76
|
|
|
77
77
|
Babel will automatically compile TypeScript files into the finished javascript, and will ignore errors.
|
|
78
78
|
|
|
@@ -88,7 +88,7 @@ To create a package which extends any of the files within the `config` directory
|
|
|
88
88
|
This is useful when you have often reused overrides to support a particular library. [Here is an example](https://github.com/lipemat/js-boilerplate-gutenberg)
|
|
89
89
|
|
|
90
90
|
### Testing
|
|
91
|
-
To use the built
|
|
91
|
+
To use the built-in testing, copy the following items from `templates` into your project root:
|
|
92
92
|
1. `jest.config.js`
|
|
93
93
|
2. `tests`
|
|
94
94
|
|
|
@@ -103,11 +103,6 @@ Now you may write `jest` tests as desired and run them via `yarn run test`
|
|
|
103
103
|
|
|
104
104
|
## Legacy Browsers Support
|
|
105
105
|
|
|
106
|
-
#### IE11
|
|
107
|
-
|
|
108
|
-
By default, IE11 is disabled via an internal Browserslist configuration. If you would like to support IE11, add it
|
|
109
|
-
as a target to your project's Browserslist configuration and all tooling will automatically support it.
|
|
110
|
-
|
|
111
106
|
#### ES6 Modules
|
|
112
107
|
|
|
113
108
|
The app will automatically detect any packages in your `package.json` which do not support ES5 and add them to the list
|
package/helpers/config.js
CHANGED
|
@@ -171,6 +171,8 @@ const getDefaultBrowsersList = () => {
|
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
173
|
* Adjust the browserslist to include our defaults.
|
|
174
|
+
*
|
|
175
|
+
* @todo Remove `not op_mini all` after 3/8/2024 if it does not creep back in to the defaults.
|
|
174
176
|
*/
|
|
175
177
|
function adjustBrowserslist( browserRules ) {
|
|
176
178
|
browserRules.push( 'not op_mini all' );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lipemat/js-boilerplate",
|
|
3
|
-
"version": "10.6.0
|
|
3
|
+
"version": "10.6.0",
|
|
4
4
|
"description": "Dependencies and scripts for a no config JavaScript app",
|
|
5
5
|
"author": "Mat Lipe",
|
|
6
6
|
"license": "MIT",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"jest-cli": "^29.0.0",
|
|
69
69
|
"jest-environment-jsdom": "^29.0.0",
|
|
70
70
|
"mini-css-extract-plugin": "^1.3.3",
|
|
71
|
+
"minimist": "^1.2.8",
|
|
71
72
|
"postcss": "^8.4.13",
|
|
72
73
|
"postcss-color-mod-function": "^3.0.3",
|
|
73
74
|
"postcss-custom-media": "^8.0.1",
|
|
@@ -92,6 +93,7 @@
|
|
|
92
93
|
},
|
|
93
94
|
"devDependencies": {
|
|
94
95
|
"@types/jest": "^29.5.3",
|
|
96
|
+
"@types/minimist": "^1",
|
|
95
97
|
"eslint": "^8",
|
|
96
98
|
"glob": "^10.3.3",
|
|
97
99
|
"memfs": "^3.5.3",
|
package/scripts/lint.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import {ESLint} from 'eslint';
|
|
2
|
+
import minimist from 'minimist';
|
|
2
3
|
|
|
3
4
|
import packageConfig from '../helpers/package-config';
|
|
4
5
|
|
|
6
|
+
// Command line arguments.
|
|
7
|
+
const flags = minimist( process.argv.slice( 2 ) );
|
|
8
|
+
|
|
5
9
|
/**
|
|
6
10
|
* ESLint does not have a utility method for detecting if
|
|
7
11
|
* any error has occurred, nor does it set the exit code.
|
|
@@ -19,9 +23,9 @@ function errorOccurred( results: ESLint.LintResult[] ): boolean {
|
|
|
19
23
|
* @link https://eslint.org/docs/developer-guide/nodejs-api
|
|
20
24
|
*/
|
|
21
25
|
( async function main() {
|
|
22
|
-
// 1. Create an instance with the `fix`
|
|
26
|
+
// 1. Create an instance with the `fix` and `cache` options.
|
|
23
27
|
const eslint = new ESLint( {
|
|
24
|
-
fix: true,
|
|
28
|
+
fix: ( flags.fix ?? true ) !== 'false',
|
|
25
29
|
cache: true,
|
|
26
30
|
cacheStrategy: 'content',
|
|
27
31
|
} );
|