pl-preset 0.0.1 → 0.0.3

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 CHANGED
@@ -1,4 +1,4 @@
1
- # PL-PRESET
1
+ # pl-preset
2
2
 
3
3
  一键生成web项目格式化(Pretty)、校验(Lint)、Git提交规范等配置,支持设置开发语音(javascript、typescript),样式扩展语言(css、less、scss),前端开发框架(vue2、vue3、react)
4
4
 
package/dist/cli.js CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
  var require$$0$2 = require('node:events');
5
5
  var require$$1$1 = require('node:child_process');
6
- var require$$2$1 = require('node:path');
7
- var require$$3$3 = require('node:fs');
6
+ var require$$2$2 = require('node:path');
7
+ var require$$3$2 = require('node:fs');
8
8
  var require$$4$1 = require('node:process');
9
9
  var require$$0$3 = require('os');
10
10
  var require$$1$2 = require('tty');
@@ -15,11 +15,11 @@ var require$$0$6 = require('util');
15
15
  var require$$0$8 = require('assert');
16
16
  var require$$1$3 = require('path');
17
17
  var require$$1$4 = require('readline');
18
- var require$$2$2 = require('events');
18
+ var require$$2$3 = require('events');
19
19
  var require$$0$9 = require('buffer');
20
20
  var require$$1$6 = require('child_process');
21
21
  var require$$1$5 = require('string_decoder');
22
- var require$$2$3 = require('crypto');
22
+ var require$$2$4 = require('crypto');
23
23
 
24
24
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
25
25
 
@@ -1508,8 +1508,8 @@ function requireCommand () {
1508
1508
  hasRequiredCommand = 1;
1509
1509
  const EventEmitter = require$$0$2.EventEmitter;
1510
1510
  const childProcess = require$$1$1;
1511
- const path = require$$2$1;
1512
- const fs = require$$3$3;
1511
+ const path = require$$2$2;
1512
+ const fs = require$$3$2;
1513
1513
  const process = require$$4$1;
1514
1514
 
1515
1515
  const { Argument, humanReadableArgName } = requireArgument();
@@ -22294,7 +22294,7 @@ function requireSignalExit () {
22294
22294
  var signals = requireSignals();
22295
22295
  var isWin = /^win/i.test(process.platform);
22296
22296
 
22297
- var EE = require$$2$2;
22297
+ var EE = require$$2$3;
22298
22298
  /* istanbul ignore if */
22299
22299
  if (typeof EE !== 'function') {
22300
22300
  EE = EE.EventEmitter;
@@ -31359,7 +31359,7 @@ function require_stream_readable () {
31359
31359
  Readable.ReadableState = ReadableState;
31360
31360
 
31361
31361
  /*<replacement>*/
31362
- require$$2$2.EventEmitter;
31362
+ require$$2$3.EventEmitter;
31363
31363
  var EElistenerCount = function EElistenerCount(emitter, type) {
31364
31364
  return emitter.listeners(type).length;
31365
31365
  };
@@ -40932,7 +40932,7 @@ var require$$1 = [
40932
40932
  ]
40933
40933
  ];
40934
40934
 
40935
- var require$$2 = [
40935
+ var require$$2$1 = [
40936
40936
  [
40937
40937
  "0",
40938
40938
  "\u0000",
@@ -43552,7 +43552,7 @@ var require$$2 = [
43552
43552
  ]
43553
43553
  ];
43554
43554
 
43555
- var require$$3$2 = [
43555
+ var require$$3$1 = [
43556
43556
  [
43557
43557
  "a140",
43558
43558
  "",
@@ -47937,13 +47937,13 @@ function requireDbcsData () {
47937
47937
  '936': 'cp936',
47938
47938
  'cp936': {
47939
47939
  type: '_dbcs',
47940
- table: function() { return require$$2 },
47940
+ table: function() { return require$$2$1 },
47941
47941
  },
47942
47942
 
47943
47943
  // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.
47944
47944
  'gbk': {
47945
47945
  type: '_dbcs',
47946
- table: function() { return require$$2.concat(require$$3$2) },
47946
+ table: function() { return require$$2$1.concat(require$$3$1) },
47947
47947
  },
47948
47948
  'xgbk': 'gbk',
47949
47949
  'isoir58': 'gbk',
@@ -47955,7 +47955,7 @@ function requireDbcsData () {
47955
47955
  // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0
47956
47956
  'gb18030': {
47957
47957
  type: '_dbcs',
47958
- table: function() { return require$$2.concat(require$$3$2) },
47958
+ table: function() { return require$$2$1.concat(require$$3$1) },
47959
47959
  gb18030: function() { return require$$4 },
47960
47960
  encodeSkipVals: [0x80],
47961
47961
  encodeAdd: {'€': 0xA2E3},
@@ -48625,7 +48625,7 @@ function requireTmp () {
48625
48625
  */
48626
48626
  const fs = require$$0$7;
48627
48627
  const path = require$$1$3;
48628
- const crypto = require$$2$3;
48628
+ const crypto = require$$2$4;
48629
48629
  const osTmpDir = requireOsTmpdir();
48630
48630
  const _c = process.binding('constants');
48631
48631
 
@@ -50131,7 +50131,7 @@ function requireUtils () {
50131
50131
  }
50132
50132
 
50133
50133
  var version$1 = "3.1.10";
50134
- var require$$3$1 = {
50134
+ var require$$3 = {
50135
50135
  version: version$1};
50136
50136
 
50137
50137
  /*
@@ -50192,7 +50192,7 @@ function requireEjs () {
50192
50192
 
50193
50193
  var scopeOptionWarned = false;
50194
50194
  /** @type {string} */
50195
- var _VERSION_STRING = require$$3$1.version;
50195
+ var _VERSION_STRING = require$$3.version;
50196
50196
  var _DEFAULT_OPEN_DELIMITER = '<';
50197
50197
  var _DEFAULT_CLOSE_DELIMITER = '>';
50198
50198
  var _DEFAULT_DELIMITER = '%';
@@ -51606,8 +51606,8 @@ function requirePipe () {
51606
51606
  return pipe;
51607
51607
  }
51608
51608
 
51609
- var version = "1.0.0";
51610
- var require$$3 = {
51609
+ var version = "0.0.3";
51610
+ var require$$2 = {
51611
51611
  version: version};
51612
51612
 
51613
51613
  var hasRequiredSrc;
@@ -51617,10 +51617,8 @@ function requireSrc () {
51617
51617
  hasRequiredSrc = 1;
51618
51618
  const { program } = requireCommander();
51619
51619
  const { run } = requirePipe();
51620
- const { apply } = requireDeps();
51621
51620
 
51622
- const pkg = require$$3;
51623
- const { SupportedLanguage, SupportedFramework, SupportedStyleSheets } = requireConsts();
51621
+ const pkg = require$$2;
51624
51622
 
51625
51623
  // 定义当前版本
51626
51624
  program.version(pkg.version);
@@ -51630,13 +51628,7 @@ function requireSrc () {
51630
51628
 
51631
51629
  // 默认创建配置文件
51632
51630
  program.command('default', { isDefault: true }).action(() => {
51633
- // run()
51634
- apply({
51635
- language: SupportedLanguage.typescript,
51636
- framework: SupportedFramework.react,
51637
- styleSheets: SupportedStyleSheets.scss,
51638
- includeHtml: true
51639
- });
51631
+ run();
51640
51632
  });
51641
51633
 
51642
51634
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "pl-preset",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "bin": {
5
5
  "plp": "dist/cli.js"
6
6
  },
7
7
  "scripts": {
8
8
  "build": "rollup -c rollup.config.js",
9
9
  "dev": "rollup -c rollup.config.js -w",
10
- "c": "cz"
10
+ "c": "cz",
11
+ "beta": "run-s build publish:beta",
12
+ "release": "run-s build publish:prod",
13
+ "publish:prod": "npm publish",
14
+ "publish:beta": "npm publish --tag beta"
11
15
  },
12
16
  "files": [
13
17
  "dist",
14
- "templage",
18
+ "template",
15
19
  "package.json",
16
20
  "README.md"
17
21
  ],
@@ -19,6 +23,12 @@
19
23
  "author": "Chad.Ding",
20
24
  "license": "MIT",
21
25
  "description": "A cli tool to generate project common settings quickly.",
26
+ "keywords": [
27
+ "prettier",
28
+ "commitlint",
29
+ "eslint",
30
+ "stylelint"
31
+ ],
22
32
  "devDependencies": {
23
33
  "@babel/eslint-parser": "^7.28.5",
24
34
  "@babel/preset-env": "^7.28.5",
@@ -29,6 +39,7 @@
29
39
  "@rollup/plugin-json": "^6.1.0",
30
40
  "@rollup/plugin-node-resolve": "^16.0.3",
31
41
  "cz-conventional-changelog": "^3.3.0",
42
+ "npm-run-all": "^4.1.5",
32
43
  "prettier": "^3.6.2",
33
44
  "rollup": "^4.52.5"
34
45
  },
@@ -0,0 +1,19 @@
1
+ {
2
+ "semi": false,
3
+ "singleQuote": true,
4
+ "trailingComma": "none",
5
+ "printWidth": 100,
6
+ "arrowParens": "avoid",
7
+ "useTabs": true,
8
+ "tabWidth": 4<%= styleSheets != supportedStyleSheets.others ? ',' : ''%>
9
+ <%_ if (styleSheets != supportedStyleSheets.others) { _%>
10
+ "overrides": [
11
+ {
12
+ "files": ["**/*.css", "**/*.scss", "**/*.less"],
13
+ "options": {
14
+ "singleQuote": false
15
+ }
16
+ }
17
+ ]
18
+ <%_ } _%>
19
+ }
@@ -0,0 +1,119 @@
1
+ module.exports = {
2
+ extends: [
3
+ <%_ if (styleSheets == supportedStyleSheets.less) { _%>
4
+ 'stylelint-config-recommended-less',
5
+ <%_ } else if (styleSheets == supportedStyleSheets.scss) { _%>
6
+ 'stylelint-config-recommended-scss',
7
+ <%_ } _%>
8
+ <%_ if (vue) { _%>
9
+ 'stylelint-config-html/vue',
10
+ <%_ } _%>
11
+ 'stylelint-config-standard',
12
+ 'stylelint-config-recess-order'
13
+ ],
14
+ plugins: [
15
+ <%_ if (styleSheets == supportedStyleSheets.scss) { _%>
16
+ 'stylelint-scss',
17
+ <%_ } else if (styleSheets == supportedStyleSheets.less) { _%>
18
+ 'stylelint-less',
19
+ <%_ } _%>
20
+ 'stylelint-order'
21
+ ],
22
+ rules: {
23
+ <%_ if (styleSheets == supportedStyleSheets.scss) { _%>
24
+ // SCSS嵌套语法检查
25
+ 'scss/at-extend-no-missing-placeholder': true,
26
+ 'scss/at-import-no-partial-leading-underscore': true,
27
+ 'scss/at-import-partial-extension-blacklist': ['scss', 'sass'],
28
+ 'scss/dollar-variable-pattern': [
29
+ '^[a-z0-9\\-_]+$',
30
+ {
31
+ message: '变量名只能由小写字母、数字、中划线和下划线组成'
32
+ }
33
+ ],
34
+ <%_ } else if (styleSheets == supportedStyleSheets.less) {_%>
35
+ // Less 语法检查规则
36
+ 'less/color-no-invalid-hex': true,
37
+ 'less/color-hex-case': 'lower',
38
+ <%_ } _%>
39
+ 'value-keyword-case': null,
40
+ // 处理 Tailwind CSS 的 at-rule
41
+ 'at-rule-no-unknown': [
42
+ true,
43
+ {
44
+ ignoreAtRules: ['apply', 'layer', 'responsive', 'screen', 'tailwind', 'variants']
45
+ }
46
+ ],
47
+ 'declaration-block-trailing-semicolon': null,
48
+ 'no-descending-specificity': null,
49
+ // 不支持浏览器前缀,自行使用autoprefixer添加
50
+ 'at-rule-no-vendor-prefix': true,
51
+ 'media-feature-name-no-vendor-prefix': true,
52
+ 'property-no-vendor-prefix': true,
53
+ 'selector-no-vendor-prefix': true,
54
+ 'value-no-vendor-prefix': true,
55
+ // 多行规则前总是有空行
56
+ 'rule-empty-line-before': [
57
+ 'always-multi-line',
58
+ {
59
+ except: ['first-nested'],
60
+ ignore: ['after-comment']
61
+ }
62
+ ],
63
+ // 最大嵌套深度
64
+ 'max-nesting-depth': [
65
+ 5,
66
+ {
67
+ ignoreAtRules: ['media', 'each', 'supports', 'include']
68
+ }
69
+ ],
70
+ // 匹配规则中不限制选择器的个数
71
+ 'selector-max-compound-selectors': null,
72
+ // 匹配规则中最多只能出现一个id选择器
73
+ 'selector-max-id': 1,
74
+ // 禁止用元素选择器来修饰某个选择器
75
+ 'selector-no-qualifying-type': [
76
+ true,
77
+ {
78
+ ignore: ['attribute', 'class']
79
+ }
80
+ ],
81
+ // 类选择器模式,类名只能由小写字母、数字和连字符组成
82
+ 'selector-class-pattern': [
83
+ '^[a-z0-9\\-_]+$',
84
+ {
85
+ message: '类名只能由小写字母、数字、中划线和下划线组成'
86
+ }
87
+ ],
88
+ // 禁止未知的伪元素
89
+ 'selector-pseudo-element-no-unknown': [true],
90
+ // 禁止颜色名称
91
+ 'color-named': 'never',
92
+ // url()中地址必须使用引号
93
+ 'function-url-quotes': 'always',
94
+ // 能简写的属性尽量简写,禁止冗余的值
95
+ 'shorthand-property-no-redundant-values': true,
96
+ // 规则集大括号里的内容排序方式
97
+ 'order/properties-order': null,
98
+ 'order/properties-alphabetical-order': true
99
+ },
100
+ overrides: [
101
+ <%_ if (vue) { _%>
102
+ {
103
+ files: ['**/*.vue'],
104
+ customSyntax: 'postcss-html'
105
+ }<%= styleSheets == supportedStyleSheets.less || styleSheets == supportedStyleSheets.scss ? ',' : ''%>
106
+ <%_ } _%>
107
+ <%_ if (styleSheets == supportedStyleSheets.less) { _%>
108
+ {
109
+ files: ['**/*.less'],
110
+ customSyntax: 'postcss-less'
111
+ }
112
+ <%_ } else if (styleSheets == supportedStyleSheets.scss) { _%>
113
+ {
114
+ files: ['**/*.scss'],
115
+ customSyntax: 'postcss-scss'
116
+ }
117
+ <%_ } _%>
118
+ ]
119
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "recommendations": [
3
+ "esbenp.prettier-vscode",
4
+ "dbaeumer.vscode-eslint",
5
+ <%_ if (style) { _%>
6
+ "stylelint.vscode-stylelint",
7
+ <%_ } _%>
8
+ <%_ if (vue) { _%>
9
+ "octref.vetur"
10
+ <%_ } _%>
11
+ ]
12
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ <%_ if (framework == supportedFramework.vue2 || framework == supportedFramework.vue3) { _%>
3
+ "[vue]": {
4
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
5
+ },
6
+ <%_ } _%>
7
+ <%_ if (language == supportedLanguage.typescript) { _%>
8
+ "[typescript]": {
9
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
10
+ },
11
+ <%_ } else if (language == supportedLanguage.javascript) { _%>
12
+ "[javascript]": {
13
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
14
+ },
15
+ <%_ } _%>
16
+ <%_ if (styleSheets == supportedStyleSheets.css) { _%>
17
+ "css.validate": false,
18
+ "[css]": {
19
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
20
+ },
21
+ <%_ } else if (styleSheets === supportedStyleSheets.scss) { _%>
22
+ "scss.validate": false,
23
+ "[scss]": {
24
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
25
+ },
26
+ <%_ } else if (styleSheets === supportedStyleSheets.less) { _%>
27
+ "less.validate": false,
28
+ "[less]": {
29
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
30
+ },
31
+ <%_ } _%>
32
+ "eslint.validate": [
33
+ <%_ if (framework == supportedFramework.react) { _%>
34
+ "javascriptreact",
35
+ "typescriptreact",
36
+ <%_ } _%>
37
+ "javascript",
38
+ "typescript"
39
+ ],
40
+ "stylelint.validate": ["css", "scss", "vue", "less", "postcss"],
41
+ "files.eol": "\n",
42
+ "files.insertFinalNewline": true,
43
+ "editor.formatOnSave": true,
44
+ "editor.codeActionsOnSave": {
45
+ "source.fixAll": "explicit"
46
+ },
47
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
48
+ "javascript.format.enable": false,
49
+ "vetur.format.enable": false,
50
+ "editor.formatOnPaste": true,
51
+ "editor.formatOnType": true,
52
+ "prettier.useTabs": true
53
+ }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: ['@commitlint/config-conventional']
3
+ }
@@ -0,0 +1,182 @@
1
+ const js = require('@eslint/js')
2
+ const globals = require('globals')
3
+ const eslintParser = require('@babel/eslint-parser')
4
+ const eslintPretterPlugin = require('eslint-plugin-prettier')
5
+ <%_ if(language == supportedLanguage.typescript) { _%>
6
+ const tsParser = require('@typescript-eslint/parser')
7
+ const tsPlugin = require('@typescript-eslint/eslint-plugin')
8
+ <%_ } _%>
9
+ <%_ if (framework == supportedFramework.vue2 || framework == supportedFramework.vue3) { _%>
10
+ const vuePlugin = require('eslint-plugin-vue')
11
+ const vueParser = require('vue-eslint-parser')
12
+ <%_ } else if (framework == supportedFramework.react) { _%>
13
+ const reactHooks = require('eslint-plugin-react-hooks')
14
+ const reactPlugin = require('eslint-plugin-react')
15
+ <%_ } _%>
16
+
17
+ module.exports = [
18
+ // 忽略文件配置
19
+ {
20
+ ignores: ['node_modules/', 'dist/', 'test/', 'coverage/']
21
+ },
22
+ <%_ if(language == supportedLanguage.typescript) { _%>
23
+ // TypeScript 配置
24
+ {
25
+ files: ['**/*.ts', <%- framework == supportedFramework.react ? '\'**/*.tsx\'' : ''-%>],
26
+ plugins: {
27
+ <%_ if (framework == supportedFramework.react) { _%>
28
+ react: reactPlugin,
29
+ 'react-hooks': reactHooks,
30
+ <%_ } _%>
31
+ prettier: eslintPretterPlugin,
32
+ '@typescript-eslint': tsPlugin
33
+ },
34
+ languageOptions: {
35
+ parser: tsParser,
36
+ ecmaVersion: 'latest',
37
+ parserOptions: {
38
+ <%_ if(framework == supportedFramework.react) { _%>
39
+ ecmaFeatures: {
40
+ jsx: true
41
+ },
42
+ <%_ } _%>
43
+ project: "./tsconfig.json"
44
+ },
45
+ sourceType: 'module',
46
+ globals: { ...globals.browser, ...globals.node, ...globals.es2020 }
47
+ },
48
+ rules: {
49
+ ...tsPlugin.configs.recommended.rules,
50
+ <%_ if(framework == supportedFramework.react) { _%>
51
+ "react/jsx-uses-react": "error",
52
+ "react/jsx-uses-vars": "error",
53
+ "react/react-in-jsx-scope": "off",
54
+ // React Hooks 规则
55
+ "react-hooks/rules-of-hooks": "error",
56
+ "react-hooks/exhaustive-deps": "warn",
57
+ <%_ } _%>
58
+ '@typescript-eslint/no-explicit-any': 'warn',
59
+ '@typescript-eslint/explicit-function-return-type': 'off'
60
+ }
61
+ },
62
+ <%_ } _%>
63
+ <%_ if (framework == supportedFramework.vue2 || framework == supportedFramework.vue3) { _%>
64
+ // Vue 文件配置
65
+ {
66
+ files: ['**/*.vue'],
67
+ languageOptions: {
68
+ parser: vueParser,
69
+ parserOptions: {
70
+ parser: <%= language == supportedLanguage.typescript ? 'tsParser' : 'eslintParser'%>,
71
+ requireConfigFile: false,
72
+ ecmaVersion: 'latest',
73
+ sourceType: 'module'
74
+ },
75
+ globals: { ...globals.browser, ...globals.node }
76
+ <%_ if (language == supportedLanguage.javascript) { _%>
77
+ babelOptions: {
78
+ presets: ['@babel/preset-env']
79
+ }
80
+ <%_ } _%>
81
+ },
82
+ plugins: {
83
+ <%_ if (language == supportedLanguage.typescript) { _%>
84
+ '@typescript-eslint': tsPlugin,
85
+ <%_ } _%>
86
+ vue: vuePlugin
87
+ },
88
+ rules: {
89
+ <%_ if (language == supportedLanguage.typescript) { _%>
90
+ ...tsPlugin.configs.recommended.rules,
91
+ <%_ } else { _%>
92
+ ...js.configs.recommended.rules,
93
+ <%_ } _%>
94
+ ...vuePlugin.configs['flat/base'].rules,
95
+ <%_ if (framework == supportedFramework.vue2) { _%>
96
+ ...vuePlugin.configs['flat/vue2-recommended'].rules,
97
+ ...vuePlugin.configs['flat/vue2-strongly-recommended'].rules,
98
+ ...vuePlugin.configs['flat/vue2-essential'].rules,
99
+ <%_ } else { _%>
100
+ ...vuePlugin.configs['vue3-recommended'].rules,
101
+ ...vuePlugin.configs['vue3-strongly-recommended'].rules,
102
+ ...vuePlugin.configs['vue3-essential'].rules,
103
+ <%_ } _%>
104
+ 'vue/multi-word-component-names': 'off',
105
+ 'vue/comment-directive': 'off',
106
+ 'vue/html-indent': 'off',
107
+ 'vue/max-attributes-per-line': 'off',
108
+ 'vue/require-default-prop': 'off',
109
+ 'vue/html-closing-bracket-newline': 'off',
110
+ 'vue/html-self-closing': [
111
+ 'error',
112
+ {
113
+ html: {
114
+ void: 'always',
115
+ normal: 'always',
116
+ component: 'always'
117
+ },
118
+ svg: 'always',
119
+ math: 'always'
120
+ }
121
+ ]
122
+ }
123
+ },
124
+ <%_ } _%>
125
+ // 基础 JavaScript 配置
126
+ {
127
+ files: ['**/*.js', <%- framework == supportedFramework.react ? '\'**/*.jsx\'' : '' -%>],
128
+ languageOptions: {
129
+ ecmaVersion: 'latest',
130
+ sourceType: 'module',
131
+ parser: eslintParser,
132
+ parserOptions: {
133
+ requireConfigFile: false,
134
+ <%_ if (framework == supportedFramework.react) { _%>
135
+ ecmaFeatures: {
136
+ jsx: true
137
+ },
138
+ <%_ } _%>
139
+ babelOptions: {
140
+ babelrc: false,
141
+ configFile: false,
142
+ presets: ['@babel/preset-env']
143
+ }
144
+ },
145
+ globals: { ...globals.browser, ...globals.node, ...globals.es2020 }
146
+ },
147
+ plugins: {
148
+ <%_ if (framework == supportedFramework.react) { _%>
149
+ react: reactPlugin,
150
+ 'react-hooks': reactHooks,
151
+ <%_ } _%>
152
+ prettier: eslintPretterPlugin
153
+ },
154
+ <%_ if (framework == supportedFramework.react) { _%>
155
+ settings: {
156
+ react: {
157
+ version: "detect"
158
+ }
159
+ },
160
+ <%_ } _%>
161
+ rules: {
162
+ ...js.configs.recommended.rules,
163
+ <%_ if(framework == supportedFramework.react) { _%>
164
+ "react/jsx-uses-react": "error",
165
+ "react/jsx-uses-vars": "error",
166
+ "react/react-in-jsx-scope": "off",
167
+ // React Hooks 规则
168
+ "react-hooks/rules-of-hooks": "error",
169
+ "react-hooks/exhaustive-deps": "warn",
170
+ <%_ } _%>
171
+ 'prettier/prettier': [
172
+ 'error',
173
+ {
174
+ singleQuote: true,
175
+ semi: false
176
+ }
177
+ ],
178
+ 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
179
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
180
+ }
181
+ }
182
+ ]