@cabloy/lint 5.0.0 → 5.0.1

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,35 +1,64 @@
1
- import stylistic from '@stylistic/eslint-plugin';
2
- import parserTs from '@typescript-eslint/parser';
3
- import tseslint from 'typescript-eslint';
1
+ import antfu from '@antfu/eslint-config';
4
2
  import globals from 'globals';
5
3
  import { rules } from '../common/rules.js';
6
4
 
7
- export default [
8
- ...tseslint.configs.recommended,
9
- stylistic.configs.customize({
10
- flat: true,
11
- indent: 2,
12
- quotes: 'single',
13
- semi: true,
14
- jsx: true,
15
- }),
16
- {
5
+ export default function eslintConfig(config, ...args) {
6
+ config = Object.assign({
7
+ stylistic: {
8
+ indent: 2,
9
+ quotes: 'single',
10
+ semi: true,
11
+ jsx: true,
12
+ },
13
+ typescript: true,
14
+ }, config);
15
+ return antfu(config, {
16
+ files: ['**/*.ts', '**/*.tsx'],
17
+ rules,
17
18
  languageOptions: {
18
- parser: parserTs,
19
- parserOptions: {
20
- ecmaFeatures: {
21
- jsx: true,
22
- tsx: true,
23
- },
24
- ecmaVersion: 'latest',
25
- useJSXTextNode: true,
26
- sourceType: 'module',
27
- },
28
19
  globals: {
29
20
  ...globals.node,
30
21
  ...globals.jest,
31
22
  },
32
23
  },
33
- rules,
34
- },
35
- ];
24
+ }, ...args);
25
+ }
26
+
27
+ // export default function eslintConfig(config, ...args) {
28
+ // return [
29
+ // ...tseslint.configs.recommended,
30
+ // stylistic.configs.customize({
31
+ // flat: true,
32
+ // indent: 2,
33
+ // quotes: 'single',
34
+ // semi: true,
35
+ // jsx: true,
36
+ // }),
37
+ // {
38
+ // files,
39
+ // languageOptions: {
40
+ // parser: parserTs,
41
+ // parserOptions: {
42
+ // ecmaFeatures: {
43
+ // jsx: true,
44
+ // tsx: true,
45
+ // },
46
+ // ecmaVersion: 'latest',
47
+ // useJSXTextNode: true,
48
+ // sourceType: 'module',
49
+ // },
50
+ // globals: {
51
+ // ...globals.node,
52
+ // ...globals.jest,
53
+ // },
54
+ // },
55
+ // rules,
56
+ // },
57
+ // {
58
+ // files: ['**/*.json'],
59
+ // ignores: ['package-lock.json'],
60
+ // language: 'json/json',
61
+ // ...json.configs.recommended,
62
+ // },
63
+ // ];
64
+ // }
@@ -1,32 +1,32 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "composite": true,
4
3
  "incremental": true,
5
- "declaration": true,
6
- "declarationMap": true,
7
- "sourceMap": true,
8
- "noEmit": false,
9
- "noEmitOnError": true,
4
+ "composite": true,
10
5
  "target": "ES2020",
6
+ "useDefineForClassFields": true,
7
+ "emitDecoratorMetadata": true,
8
+ "experimentalDecorators": true,
11
9
  "module": "NodeNext",
12
10
  "moduleResolution": "NodeNext",
11
+ "resolveJsonModule": true,
12
+ "resolvePackageJsonImports": true,
13
+ "allowJs": false,
14
+ "checkJs": false,
13
15
  "strict": true,
16
+ "strictPropertyInitialization": false,
14
17
  "noImplicitAny": false,
15
18
  "noUnusedLocals": true,
16
19
  "noUnusedParameters": true,
17
- "strictPropertyInitialization": false,
18
- "useDefineForClassFields": true,
19
- "forceConsistentCasingInFileNames": true,
20
- "resolvePackageJsonImports": true,
21
- "resolveJsonModule": true,
22
- "allowSyntheticDefaultImports": true,
20
+ "declaration": true,
21
+ "declarationMap": true,
22
+ "noEmit": false,
23
+ "noEmitOnError": true,
24
+ "sourceMap": true,
23
25
  "stripInternal": true,
26
+ "allowSyntheticDefaultImports": true,
24
27
  "esModuleInterop": true,
28
+ "forceConsistentCasingInFileNames": true,
25
29
  "isolatedModules": true,
26
- "experimentalDecorators": true,
27
- "emitDecoratorMetadata": true,
28
- "allowJs": false,
29
- "checkJs": false,
30
- "skipLibCheck": true,
30
+ "skipLibCheck": true
31
31
  }
32
32
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "extends":"./tsconfig.base.cjs",
2
+ "extends": "./tsconfig.base.cjs",
3
3
  "compilerOptions": {}
4
4
  }
package/common/rules.js CHANGED
@@ -1,4 +1,13 @@
1
1
  export const rules = {
2
+ 'no-extend-native': ['error', { exceptions: ['Set'] }],
3
+ 'no-new-func': 'off',
4
+ 'regexp/no-super-linear-backtracking': 'off',
5
+ 'no-template-curly-in-string': 'off',
6
+ 'n/prefer-global/process': 'off',
7
+ 'unicorn/error-message': 'off',
8
+ 'antfu/if-newline': 'off',
9
+ 'import/no-duplicates': 'off',
10
+ 'eslint-comments/no-unlimited-disable': 'off',
2
11
  'prefer-promise-reject-errors': 'off',
3
12
  'no-console': 'warn',
4
13
  'no-debugger': 'warn',
@@ -51,11 +60,25 @@ export const rules = {
51
60
  'newline-per-chained-call': [0],
52
61
  'prefer-rest-params': 'off',
53
62
  // 'no-setter-return': 'off', // no effect for typescript check
63
+ 'ts/method-signature-style': 'off',
64
+ 'ts/no-redeclare': 'off',
54
65
  '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
55
66
  '@typescript-eslint/explicit-function-return-type': 'off',
56
67
  '@typescript-eslint/no-namespace': 'off',
57
68
  '@typescript-eslint/no-explicit-any': 'off',
58
69
  '@typescript-eslint/no-var-requires': 'off',
70
+ 'unused-imports/no-unused-vars': [
71
+ 'error',
72
+ {
73
+ args: 'all',
74
+ argsIgnorePattern: '^_',
75
+ caughtErrors: 'all',
76
+ caughtErrorsIgnorePattern: '^_',
77
+ destructuredArrayIgnorePattern: '^_',
78
+ varsIgnorePattern: '^_',
79
+ ignoreRestSiblings: true,
80
+ },
81
+ ],
59
82
  '@typescript-eslint/no-unused-vars': [
60
83
  'error',
61
84
  {
@@ -80,7 +103,8 @@ export const rules = {
80
103
  '@typescript-eslint/no-empty-object-type': 'off',
81
104
  '@typescript-eslint/no-unsafe-function-type': 'off',
82
105
  '@stylistic/max-len': ['error', {
83
- code: 130, tabWidth: 2,
106
+ code: 130,
107
+ tabWidth: 2,
84
108
  ignoreComments: true,
85
109
  ignoreTrailingComments: true,
86
110
  ignoreUrls: true,
@@ -96,7 +120,9 @@ export const rules = {
96
120
  this: { before: true },
97
121
  } }],
98
122
  '@stylistic/indent': ['error', 2, {
99
- SwitchCase: 1, VariableDeclarator: 'first', outerIIFEBody: 1,
123
+ SwitchCase: 1,
124
+ VariableDeclarator: 'first',
125
+ outerIIFEBody: 1,
100
126
  MemberExpression: 1,
101
127
  FunctionDeclaration: { body: 1, parameters: 1 },
102
128
  FunctionExpression: { body: 1, parameters: 1 },
package/front/eslint.js CHANGED
@@ -1,35 +1,32 @@
1
- import stylistic from '@stylistic/eslint-plugin';
2
- import vueParser from 'vue-eslint-parser';
3
- import parserTs from '@typescript-eslint/parser';
4
- import tseslint from 'typescript-eslint';
5
- import eslintVue from 'eslint-plugin-vue';
1
+ import antfu from '@antfu/eslint-config';
6
2
  import globals from 'globals';
7
3
  import { rules } from '../common/rules.js';
8
4
  import { rulesVue } from '../common/rulesVue.js';
9
5
 
10
- export default [
11
- ...tseslint.configs.recommended,
12
- ...eslintVue.configs['flat/recommended'],
13
- stylistic.configs.customize({
14
- indent: 2,
15
- quotes: 'single',
16
- semi: true,
17
- jsx: true,
18
- }),
19
- {
6
+ export default function eslintConfig(config, ...args) {
7
+ config = Object.assign({
8
+ stylistic: {
9
+ indent: 2,
10
+ quotes: 'single',
11
+ semi: true,
12
+ jsx: true,
13
+ },
14
+ typescript: true,
15
+ vue: true,
16
+ }, config);
17
+ return antfu(config, {
18
+ files: ['**/*.ts', '**/*.tsx'],
19
+ rules,
20
20
  languageOptions: {
21
- parser: vueParser,
22
- parserOptions: {
23
- extraFileExtensions: ['.vue'],
24
- ecmaFeatures: {
25
- jsx: true,
26
- tsx: true,
27
- },
28
- ecmaVersion: 'latest',
29
- useJSXTextNode: true,
30
- sourceType: 'module',
31
- parser: parserTs,
21
+ globals: {
22
+ ...globals.node,
23
+ ...globals.jest,
32
24
  },
25
+ },
26
+ }, {
27
+ files: ['**/*.vue'],
28
+ rules: Object.assign({}, rules, rulesVue),
29
+ languageOptions: {
33
30
  globals: {
34
31
  ...globals.browser,
35
32
  ...globals.jest,
@@ -43,17 +40,68 @@ export default [
43
40
  process: 'readonly',
44
41
  Capacitor: 'readonly',
45
42
  chrome: 'readonly',
46
- // $: true,
47
- // util: true,
48
- // env: true,
49
- // App: true,
50
- // getApp: true,
51
- // Page: true,
52
- // wx: true,
53
- // define: true,
54
- Proxy: true,
55
43
  },
56
44
  },
57
- rules: Object.assign({}, rules, rulesVue),
58
- },
59
- ];
45
+ }, ...args);
46
+ }
47
+
48
+ // export default [
49
+ // ...tseslint.configs.recommended,
50
+ // ...eslintVue.configs['flat/recommended'],
51
+ // stylistic.configs.customize({
52
+ // indent: 2,
53
+ // quotes: 'single',
54
+ // semi: true,
55
+ // jsx: true,
56
+ // }),
57
+ // {
58
+ // languageOptions: {
59
+ // parser: vueParser,
60
+ // parserOptions: {
61
+ // extraFileExtensions: ['.vue'],
62
+ // ecmaFeatures: {
63
+ // jsx: true,
64
+ // tsx: true,
65
+ // },
66
+ // ecmaVersion: 'latest',
67
+ // useJSXTextNode: true,
68
+ // sourceType: 'module',
69
+ // parser: parserTs,
70
+ // },
71
+ // globals: {
72
+ // ...globals.browser,
73
+ // ...globals.jest,
74
+ // ga: 'readonly', // Google Analytics
75
+ // cordova: 'readonly',
76
+ // __statics: 'readonly',
77
+ // __QUASAR_SSR__: 'readonly',
78
+ // __QUASAR_SSR_SERVER__: 'readonly',
79
+ // __QUASAR_SSR_CLIENT__: 'readonly',
80
+ // __QUASAR_SSR_PWA__: 'readonly',
81
+ // process: 'readonly',
82
+ // Capacitor: 'readonly',
83
+ // chrome: 'readonly',
84
+ // // $: true,
85
+ // // util: true,
86
+ // // env: true,
87
+ // // App: true,
88
+ // // getApp: true,
89
+ // // Page: true,
90
+ // // wx: true,
91
+ // // define: true,
92
+ // Proxy: true,
93
+ // },
94
+ // },
95
+ // rules: Object.assign({}, rules, rulesVue),
96
+ // },
97
+ // {
98
+ // plugins: {
99
+ // json,
100
+ // },
101
+ // files: ['**/*.json'],
102
+ // language: 'json/json',
103
+ // rules: {
104
+ // 'json/no-duplicate-keys': 'error',
105
+ // },
106
+ // },
107
+ // ];
@@ -1,4 +1,4 @@
1
1
  {
2
- "extends":"../api/tsconfig.base.cjs",
2
+ "extends": "../api/tsconfig.base.cjs",
3
3
  "compilerOptions": {}
4
4
  }
package/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "@cabloy/lint",
3
- "version": "5.0.0",
3
+ "type": "module",
4
+ "version": "5.0.1",
4
5
  "description": "Node Style Guide for Cabloy.",
5
6
  "publishConfig": {
6
7
  "access": "public"
7
8
  },
8
- "type": "module",
9
9
  "files": [
10
10
  "api",
11
11
  "common",
12
12
  "front"
13
13
  ],
14
14
  "dependencies": {
15
+ "@antfu/eslint-config": "^4.2.1",
16
+ "@eslint/json": "^0.10.0",
15
17
  "@stylistic/eslint-plugin": "^3.1.0",
16
18
  "@typescript-eslint/parser": "^8.24.0",
17
19
  "eslint-plugin-vue": "^9.32.0",