@cabloy/lint 5.0.20 → 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
@@ -1,4 +1,10 @@
1
1
  export const rules = {
2
+ 'e18e/prefer-spread-syntax': 'off',
3
+ 'e18e/prefer-object-has-own': 'off',
4
+ 'e18e/prefer-static-regex': 'off',
5
+ 'e18e/prefer-array-at': 'off',
6
+ 'e18e/prefer-regex-test': 'off',
7
+ 'regexp/no-unused-capturing-group': 'off',
2
8
  'test/no-only-tests': 'off',
3
9
  'test/no-import-node-test': 'off',
4
10
  'jsdoc/check-alignment': 'off',
@@ -108,37 +114,49 @@ export const rules = {
108
114
  '@typescript-eslint/no-empty-object-type': 'off',
109
115
  '@typescript-eslint/no-unsafe-function-type': 'off',
110
116
  '@typescript-eslint/no-use-before-define': ['error', { functions: false }],
111
- '@stylistic/max-len': ['error', {
112
- code: 150,
113
- tabWidth: 2,
114
- ignoreComments: true,
115
- ignoreTrailingComments: true,
116
- ignoreUrls: true,
117
- ignoreStrings: true,
118
- ignoreTemplateLiterals: true,
119
- ignoreRegExpLiterals: true,
120
- }],
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
+ ],
121
130
  '@stylistic/arrow-parens': ['error', 'as-needed'],
122
131
  '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
123
132
  '@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
124
133
  '@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
125
- '@stylistic/keyword-spacing': ['error', { overrides: {
126
- this: { before: true },
127
- } }],
128
- '@stylistic/indent': ['error', 2, {
129
- SwitchCase: 1,
130
- VariableDeclarator: 'first',
131
- outerIIFEBody: 1,
132
- MemberExpression: 1,
133
- FunctionDeclaration: { body: 1, parameters: 1 },
134
- FunctionExpression: { body: 1, parameters: 1 },
135
- StaticBlock: { body: 1 },
136
- CallExpression: { arguments: 1 },
137
- ArrayExpression: 1,
138
- ObjectExpression: 1,
139
- ImportDeclaration: 1,
140
- flatTernaryExpressions: true,
141
- offsetTernaryExpressions: true,
142
- }],
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
+ ],
143
161
  '@stylistic/jsx-closing-tag-location': 'off',
144
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
+ }