@naturalcycles/dev-lib 12.1.5 → 12.3.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## [12.3.2](https://github.com/NaturalCycles/dev-lib/compare/v12.3.1...v12.3.2) (2021-09-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * lint-staged vue files ([6f321e1](https://github.com/NaturalCycles/dev-lib/commit/6f321e1a2047649650114b61a67d5fbc958caf52))
7
+
8
+ ## [12.3.1](https://github.com/NaturalCycles/dev-lib/compare/v12.3.0...v12.3.1) (2021-09-17)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * forgot .vue extension in lint-staged.config.js ([f0e0404](https://github.com/NaturalCycles/dev-lib/commit/f0e04045c41b255f6fa2b053da42bc6cd327cc2c))
14
+
15
+ # [12.3.0](https://github.com/NaturalCycles/dev-lib/compare/v12.2.0...v12.3.0) (2021-09-17)
16
+
17
+
18
+ ### Features
19
+
20
+ * **eslint:** enable eslint-plugin-vue by default ([f554e3c](https://github.com/NaturalCycles/dev-lib/commit/f554e3c30c5945d943e02d8d03e492c55f2fa270))
21
+
22
+ # [12.2.0](https://github.com/NaturalCycles/dev-lib/compare/v12.1.5...v12.2.0) (2021-09-17)
23
+
24
+
25
+ ### Features
26
+
27
+ * **eslint:** add `eslint-plugin-prettier` ([a21110e](https://github.com/NaturalCycles/dev-lib/commit/a21110e48d4122b1f1926e6f4863b9e33fe4cad9))
28
+
1
29
  ## [12.1.5](https://github.com/NaturalCycles/dev-lib/compare/v12.1.4...v12.1.5) (2021-09-14)
2
30
 
3
31
 
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @naturalcycles/dev-lib/cfg/eslint-vue.config.js
3
+ */
4
+ module.exports = {
5
+ extends: [
6
+ './eslint.config.js',
7
+ 'plugin:vue/recommended',
8
+ 'prettier', // must go last
9
+ ],
10
+ env: {
11
+ browser: true,
12
+ },
13
+ parser: 'vue-eslint-parser',
14
+ parserOptions: {
15
+ parser: '@typescript-eslint/parser',
16
+ extraFileExtensions: ['.vue'],
17
+ },
18
+ rules: {},
19
+ }
@@ -24,6 +24,7 @@ module.exports = {
24
24
  // 'plugin:jest/recommended', // add manually if needed!
25
25
  // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/configs/recommended.js
26
26
  'plugin:unicorn/recommended',
27
+ 'prettier', // must be last! it only turns off eslint rules that conflict with prettier
27
28
  ],
28
29
  ignorePatterns: ['**/__exclude/**'],
29
30
  parser: '@typescript-eslint/parser',
@@ -33,8 +34,8 @@ module.exports = {
33
34
  ecmaVersion: 2020,
34
35
  },
35
36
  plugins: [
36
- 'eslint-plugin-jsdoc',
37
- 'eslint-plugin-import',
37
+ 'jsdoc',
38
+ 'import',
38
39
  '@typescript-eslint',
39
40
  'unused-imports',
40
41
  // 'jest', // add manually if needed!
@@ -37,15 +37,17 @@ const styleLintCmd = `stylelint --fix --config ${stylelintConfigPath}`
37
37
  const linters = {
38
38
  // *.ts files: eslint, tslint, prettier
39
39
  // There are 2 tslint tasks, one without `-p` and the second is with `-p` - it is a speed optimization
40
- './src/**/*.{ts,tsx}': match => {
41
- const filesList = micromatch.not(match, lintExclude).join(' ')
42
- if (!filesList) return []
40
+ './src/**/*.{ts,tsx,vue}': match => {
41
+ const files = micromatch.not(match, lintExclude)
42
+ if (!files) return []
43
+ const filesList = files.join(' ')
44
+ const filesListNoVue = micromatch.not(files, ['**/*.vue']).join(' ')
43
45
  return [
44
- `${eslintCmd} --config ${eslintConfigPathRoot} --parser-options=project:./${tsconfigPathRoot}`,
45
- tslintCmd,
46
- `${tslintCmd} -p ${tsconfigPathRoot}`,
47
- prettierCmd,
48
- ].map(s => `${s} ${filesList}`)
46
+ `${eslintCmd} --config ${eslintConfigPathRoot} --parser-options=project:./${tsconfigPathRoot} ${filesList}`,
47
+ `${tslintCmd} ${filesListNoVue}`,
48
+ `${tslintCmd} -p ${tsconfigPathRoot} ${filesListNoVue}`,
49
+ `${prettierCmd} ${filesList}`,
50
+ ]
49
51
  },
50
52
 
51
53
  // For all other files we run only Prettier (because e.g TSLint screws *.scss files)
@@ -42,7 +42,7 @@ async function runESLint(dir, eslintConfigPath, tsconfigPath) {
42
42
  const args = [
43
43
  `--config`,
44
44
  eslintConfigPath,
45
- `${dir}/**/*.{ts,tsx}`,
45
+ `${dir}/**/*.{ts,tsx,vue}`,
46
46
  ...(tsconfigPath ? [`--parser-options=project:${tsconfigPath}`] : []),
47
47
  `--no-error-on-unmatched-pattern`,
48
48
  `--fix`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
- "version": "12.1.5",
3
+ "version": "12.3.2",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "tsn-debug": "tsn testScript.ts",
@@ -26,6 +26,7 @@
26
26
  "lint-all": "tsn ./src/bin/lint-all.ts",
27
27
  "lint-circleci": "tsn ./src/bin/lint-circleci.ts",
28
28
  "eslint-all": "tsn ./src/bin/eslint-all.ts",
29
+ "eslint-print-config": "eslint --print-config src/index.ts > tmp/eslint.config.json",
29
30
  "update-from-dev-lib": "tsn ./src/bin/update-from-dev-lib.ts"
30
31
  },
31
32
  "dependencies": {
@@ -43,11 +44,13 @@
43
44
  "@typescript-eslint/parser": "^4.22.1",
44
45
  "command-exists": "^1.2.8",
45
46
  "eslint": "^7.26.0",
47
+ "eslint-config-prettier": "^8.3.0",
46
48
  "eslint-plugin-import": "^2.22.1",
47
49
  "eslint-plugin-jest": "^24.3.6",
48
50
  "eslint-plugin-jsdoc": "^36.0.2",
49
51
  "eslint-plugin-unicorn": "^36.0.0",
50
52
  "eslint-plugin-unused-imports": "^1.1.1",
53
+ "eslint-plugin-vue": "^7.18.0",
51
54
  "execa": "^5.0.0",
52
55
  "fs-extra": "^10.0.0",
53
56
  "husky": "^7.0.0",