@cabloy/lint 5.0.21 → 5.0.22

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/api/eslint.js CHANGED
@@ -1,33 +1,41 @@
1
1
  import antfu from '@antfu/eslint-config';
2
2
  import globals from 'globals';
3
+
3
4
  import { rules } from '../common/rules.js';
4
5
 
5
6
  export default function eslintConfig(config, ...args) {
6
- config = Object.assign({
7
- // isInEditor: false,
8
- stylistic: {
9
- indent: 2,
10
- quotes: 'single',
11
- semi: true,
12
- jsx: true,
13
- },
14
- typescript: true,
15
- gitignore: false,
16
- }, config);
17
- return antfu(config, {
18
- files: ['**/*.ts', '**/*.tsx'],
19
- rules,
20
- languageOptions: {
21
- parserOptions: {
22
- emitDecoratorMetadata: true,
23
- experimentalDecorators: true,
24
- projectService: true,
7
+ config = Object.assign(
8
+ {
9
+ // isInEditor: false,
10
+ stylistic: {
11
+ indent: 2,
12
+ quotes: 'single',
13
+ semi: true,
14
+ jsx: true,
25
15
  },
26
- globals: {
27
- ...globals.node,
28
- ...globals.jest,
29
- NodeJS: true,
16
+ typescript: true,
17
+ gitignore: false,
18
+ },
19
+ config,
20
+ );
21
+ return antfu(
22
+ config,
23
+ {
24
+ files: ['**/*.ts', '**/*.tsx'],
25
+ rules,
26
+ languageOptions: {
27
+ parserOptions: {
28
+ emitDecoratorMetadata: true,
29
+ experimentalDecorators: true,
30
+ projectService: true,
31
+ },
32
+ globals: {
33
+ ...globals.node,
34
+ ...globals.jest,
35
+ NodeJS: true,
36
+ },
30
37
  },
31
38
  },
32
- }, ...args);
39
+ ...args,
40
+ );
33
41
  }
package/common/rules.js CHANGED
@@ -114,37 +114,49 @@ export const rules = {
114
114
  '@typescript-eslint/no-empty-object-type': 'off',
115
115
  '@typescript-eslint/no-unsafe-function-type': 'off',
116
116
  '@typescript-eslint/no-use-before-define': ['error', { functions: false }],
117
- '@stylistic/max-len': ['error', {
118
- code: 150,
119
- tabWidth: 2,
120
- ignoreComments: true,
121
- ignoreTrailingComments: true,
122
- ignoreUrls: true,
123
- ignoreStrings: true,
124
- ignoreTemplateLiterals: true,
125
- ignoreRegExpLiterals: true,
126
- }],
117
+ '@stylistic/max-len': [
118
+ 'error',
119
+ {
120
+ code: 150,
121
+ tabWidth: 2,
122
+ ignoreComments: true,
123
+ ignoreTrailingComments: true,
124
+ ignoreUrls: true,
125
+ ignoreStrings: true,
126
+ ignoreTemplateLiterals: true,
127
+ ignoreRegExpLiterals: true,
128
+ },
129
+ ],
127
130
  '@stylistic/arrow-parens': ['error', 'as-needed'],
128
131
  '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
129
132
  '@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
130
133
  '@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
131
- '@stylistic/keyword-spacing': ['error', { overrides: {
132
- this: { before: true },
133
- } }],
134
- '@stylistic/indent': ['error', 2, {
135
- SwitchCase: 1,
136
- VariableDeclarator: 'first',
137
- outerIIFEBody: 1,
138
- MemberExpression: 1,
139
- FunctionDeclaration: { body: 1, parameters: 1 },
140
- FunctionExpression: { body: 1, parameters: 1 },
141
- StaticBlock: { body: 1 },
142
- CallExpression: { arguments: 1 },
143
- ArrayExpression: 1,
144
- ObjectExpression: 1,
145
- ImportDeclaration: 1,
146
- flatTernaryExpressions: true,
147
- offsetTernaryExpressions: true,
148
- }],
134
+ '@stylistic/keyword-spacing': [
135
+ 'error',
136
+ {
137
+ overrides: {
138
+ this: { before: true },
139
+ },
140
+ },
141
+ ],
142
+ '@stylistic/indent': [
143
+ 'error',
144
+ 2,
145
+ {
146
+ SwitchCase: 1,
147
+ VariableDeclarator: 'first',
148
+ outerIIFEBody: 1,
149
+ MemberExpression: 1,
150
+ FunctionDeclaration: { body: 1, parameters: 1 },
151
+ FunctionExpression: { body: 1, parameters: 1 },
152
+ StaticBlock: { body: 1 },
153
+ CallExpression: { arguments: 1 },
154
+ ArrayExpression: 1,
155
+ ObjectExpression: 1,
156
+ ImportDeclaration: 1,
157
+ flatTernaryExpressions: true,
158
+ offsetTernaryExpressions: true,
159
+ },
160
+ ],
149
161
  '@stylistic/jsx-closing-tag-location': 'off',
150
162
  };
package/front/eslint.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import antfu from '@antfu/eslint-config';
2
2
  import globals from 'globals';
3
+
3
4
  import { rules } from '../common/rules.js';
4
5
  import { rulesVue } from '../common/rulesVue.js';
5
6
 
@@ -19,32 +20,40 @@ const globalsMy = {
19
20
  };
20
21
 
21
22
  export default function eslintConfig(config, ...args) {
22
- config = Object.assign({
23
- stylistic: {
24
- indent: 2,
25
- quotes: 'single',
26
- semi: true,
27
- jsx: true,
23
+ config = Object.assign(
24
+ {
25
+ stylistic: {
26
+ indent: 2,
27
+ quotes: 'single',
28
+ semi: true,
29
+ jsx: true,
30
+ },
31
+ typescript: true,
32
+ vue: true,
33
+ gitignore: false,
28
34
  },
29
- typescript: true,
30
- vue: true,
31
- gitignore: false,
32
- }, config);
33
- return antfu(config, {
34
- files: ['**/*.ts', '**/*.tsx'],
35
- rules,
36
- languageOptions: {
37
- parserOptions: {
38
- emitDecoratorMetadata: true,
39
- experimentalDecorators: true,
35
+ config,
36
+ );
37
+ return antfu(
38
+ config,
39
+ {
40
+ files: ['**/*.ts', '**/*.tsx'],
41
+ rules,
42
+ languageOptions: {
43
+ parserOptions: {
44
+ emitDecoratorMetadata: true,
45
+ experimentalDecorators: true,
46
+ },
47
+ globals: globalsMy,
40
48
  },
41
- globals: globalsMy,
42
49
  },
43
- }, {
44
- files: ['**/*.vue'],
45
- rules: Object.assign({}, rules, rulesVue),
46
- languageOptions: {
47
- globals: globalsMy,
50
+ {
51
+ files: ['**/*.vue'],
52
+ rules: Object.assign({}, rules, rulesVue),
53
+ languageOptions: {
54
+ globals: globalsMy,
55
+ },
48
56
  },
49
- }, ...args);
57
+ ...args,
58
+ );
50
59
  }
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './oxc/format.js';
2
+ export * from './oxc/lint.js';
3
+ export * from './oxc/lintVue.js';
package/oxc/format.js ADDED
@@ -0,0 +1,37 @@
1
+ export const _configDefault = {
2
+ printWidth: 150,
3
+ tabWidth: 2,
4
+ useTabs: false,
5
+ semi: true,
6
+ singleQuote: true,
7
+ jsxSingleQuote: false,
8
+ bracketSpacing: true,
9
+ trailingComma: 'all',
10
+ arrowParens: 'avoid',
11
+ quoteProps: 'consistent',
12
+ sortImports: {
13
+ groups: [
14
+ 'type-import',
15
+ ['value-builtin', 'value-external'],
16
+ 'type-internal',
17
+ 'value-internal',
18
+ ['type-parent', 'type-sibling', 'type-index'],
19
+ ['value-parent', 'value-sibling', 'value-index'],
20
+ 'unknown',
21
+ ],
22
+ },
23
+ sortPackageJson: true,
24
+ overrides: [
25
+ {
26
+ files: ['*.json'],
27
+ options: {
28
+ printWidth: 80,
29
+ trailingComma: 'none',
30
+ },
31
+ },
32
+ ],
33
+ };
34
+
35
+ export function oxcFormatConfig(configCustom) {
36
+ return Object.assign({}, _configDefault, configCustom);
37
+ }