lint-staged 8.0.5 → 8.1.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 +13 -1
- package/package.json +8 -4
- package/src/generateTasks.js +7 -2
- package/src/getConfig.js +2 -1
package/README.md
CHANGED
|
@@ -137,7 +137,7 @@ To extend and customise lint-staged, advanced options are available. To use thes
|
|
|
137
137
|
}
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
Notice that the linting commands now are nested into the `linters` object. The following options are available for
|
|
140
|
+
Notice that the linting commands now are nested into the `linters` object. The following options are available for advanced configuration:
|
|
141
141
|
|
|
142
142
|
#### Options
|
|
143
143
|
|
|
@@ -148,6 +148,7 @@ Notice that the linting commands now are nested into the `linters` object. The f
|
|
|
148
148
|
* `ignore` - `['**/docs/**/*.js']` - array of glob patterns to entirely ignore from any task.
|
|
149
149
|
* `linters` — `Object` — keys (`String`) are glob patterns, values (`Array<String> | String`) are commands to execute.
|
|
150
150
|
* `subTaskConcurrency` — `1` — Controls concurrency for processing chunks generated for each linter. This option is only applicable on Windows. Execution is **not** concurrent by default(see [#225](https://github.com/okonet/lint-staged/issues/225))
|
|
151
|
+
* `relative` — `false` — if `true` it will give the relative path from your `package.json` directory to your linter arguments.
|
|
151
152
|
|
|
152
153
|
## Filtering files
|
|
153
154
|
|
|
@@ -287,6 +288,17 @@ The following is equivalent:
|
|
|
287
288
|
}
|
|
288
289
|
```
|
|
289
290
|
|
|
291
|
+
### Use ng lint with angular cli >= 7.0.0
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"linters": {
|
|
296
|
+
"*.ts": "ng lint myProjectName --files"
|
|
297
|
+
},
|
|
298
|
+
"relative": true
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
290
302
|
### Stylelint for CSS with defaults and for SCSS with SCSS syntax
|
|
291
303
|
|
|
292
304
|
```json
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lint-staged",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "Lint files staged by git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/okonet/lint-staged",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"src"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"precommit": "node index.js",
|
|
19
18
|
"cz": "git-cz",
|
|
20
19
|
"lint:base": "eslint --rule \"prettier/prettier: 2\"",
|
|
21
20
|
"lint": "npm run lint:base -- .",
|
|
@@ -24,11 +23,16 @@
|
|
|
24
23
|
"test": "jest --coverage",
|
|
25
24
|
"test:watch": "jest --watch"
|
|
26
25
|
},
|
|
26
|
+
"husky": {
|
|
27
|
+
"hooks": {
|
|
28
|
+
"pre-commit": "node index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
27
31
|
"dependencies": {
|
|
28
32
|
"@iamstarkov/listr-update-renderer": "0.4.1",
|
|
29
33
|
"chalk": "^2.3.1",
|
|
30
34
|
"commander": "^2.14.1",
|
|
31
|
-
"cosmiconfig": "
|
|
35
|
+
"cosmiconfig": "5.0.6",
|
|
32
36
|
"debug": "^3.1.0",
|
|
33
37
|
"dedent": "^0.7.0",
|
|
34
38
|
"del": "^3.0.0",
|
|
@@ -62,7 +66,7 @@
|
|
|
62
66
|
"eslint": "^4.18.1",
|
|
63
67
|
"eslint-config-okonet": "^5.0.1",
|
|
64
68
|
"eslint-plugin-node": "^6.0.0",
|
|
65
|
-
"husky": "^
|
|
69
|
+
"husky": "^1.1.4",
|
|
66
70
|
"jest": "^23.6.0",
|
|
67
71
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
|
68
72
|
"jsonlint": "^1.6.2",
|
package/src/generateTasks.js
CHANGED
|
@@ -33,9 +33,14 @@ module.exports = function generateTasks(config, stagedRelFiles) {
|
|
|
33
33
|
.map(file => path.relative(cwd, file)),
|
|
34
34
|
patterns,
|
|
35
35
|
globOptions
|
|
36
|
-
)
|
|
36
|
+
).map(file => {
|
|
37
|
+
// if you set relative option, then the file path will be relative to your package.json
|
|
38
|
+
if (config.relative) {
|
|
39
|
+
return path.normalize(file)
|
|
40
|
+
}
|
|
37
41
|
// Return absolute path after the filter is run
|
|
38
|
-
|
|
42
|
+
return path.resolve(cwd, file)
|
|
43
|
+
})
|
|
39
44
|
|
|
40
45
|
const task = { pattern, commands, fileList }
|
|
41
46
|
debug('Generated task: \n%O', task)
|