@cabloy/lint 4.0.20 → 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,27 +1,64 @@
1
- const rules = require('../common/rules.js');
1
+ import antfu from '@antfu/eslint-config';
2
+ import globals from 'globals';
3
+ import { rules } from '../common/rules.js';
2
4
 
3
- module.exports = {
4
- extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
5
- plugins: ['@typescript-eslint', 'prettier'],
6
- parserOptions: {
7
- parser: require.resolve('@typescript-eslint/parser'),
8
- },
9
- rules,
10
- env: {
11
- browser: true,
12
- es2021: true,
13
- node: true,
14
- mocha: true,
15
- },
16
- globals: {
17
- // $: true,
18
- // util: true,
19
- // env: true,
20
- // App: true,
21
- // getApp: true,
22
- // Page: true,
23
- // wx: true,
24
- // define: true,
25
- Proxy: true,
26
- },
27
- };
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,
18
+ languageOptions: {
19
+ globals: {
20
+ ...globals.node,
21
+ ...globals.jest,
22
+ },
23
+ },
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
+ // }
package/api/prettier.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  semi: true,
3
3
  singleQuote: true,
4
4
  bracketSpacing: true,
@@ -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,21 +1,16 @@
1
- const rules = {
2
- 'prettier/prettier': ['error', { singleQuote: true }],
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',
3
11
  'prefer-promise-reject-errors': 'off',
4
- quotes: ['error', 'single', { avoidEscape: true }],
5
- '@typescript-eslint/quotes': [
6
- 'error',
7
- 'single',
8
- {
9
- avoidEscape: true,
10
- },
11
- ],
12
- // this rule, if on, would require explicit return type on the `render` function
13
- '@typescript-eslint/explicit-function-return-type': 'off',
14
- 'vue/multi-word-component-names': 'off',
15
- 'vue/prefer-import-from-vue': 'off',
16
- '@typescript-eslint/no-namespace': 'off',
17
-
18
- '@typescript-eslint/no-explicit-any': 'off',
12
+ 'no-console': 'warn',
13
+ 'no-debugger': 'warn',
19
14
  'prefer-const': [
20
15
  'error',
21
16
  {
@@ -23,20 +18,6 @@ const rules = {
23
18
  ignoreReadBeforeAssign: true,
24
19
  },
25
20
  ],
26
- 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
27
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
28
- 'max-len': [
29
- 'error',
30
- {
31
- code: 120,
32
- ignoreComments: true,
33
- ignoreTrailingComments: true,
34
- ignoreUrls: true,
35
- ignoreStrings: true,
36
- ignoreTemplateLiterals: true,
37
- ignoreRegExpLiterals: true,
38
- },
39
- ],
40
21
  'no-undef': [
41
22
  'error',
42
23
  {
@@ -77,8 +58,27 @@ const rules = {
77
58
  'space-before-function-paren': [0],
78
59
  'generator-star-spacing': [0],
79
60
  'newline-per-chained-call': [0],
80
- 'vue/multi-word-component-names': [0],
61
+ 'prefer-rest-params': 'off',
62
+ // 'no-setter-return': 'off', // no effect for typescript check
63
+ 'ts/method-signature-style': 'off',
64
+ 'ts/no-redeclare': 'off',
65
+ '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
66
+ '@typescript-eslint/explicit-function-return-type': 'off',
67
+ '@typescript-eslint/no-namespace': 'off',
68
+ '@typescript-eslint/no-explicit-any': 'off',
81
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
+ ],
82
82
  '@typescript-eslint/no-unused-vars': [
83
83
  'error',
84
84
  {
@@ -100,19 +100,38 @@ const rules = {
100
100
  'ts-ignore': 'allow-with-description',
101
101
  },
102
102
  ],
103
- '@typescript-eslint/ban-types': [
104
- 'error',
105
- {
106
- types: {
107
- // un-ban a type that's banned by default
108
- '{}': false,
109
- Function: false,
110
- },
111
- extendDefaults: true,
112
- },
113
- ],
114
- 'prefer-rest-params': 'off',
115
- // 'no-setter-return': 'off', // no effect for typescript check
103
+ '@typescript-eslint/no-empty-object-type': 'off',
104
+ '@typescript-eslint/no-unsafe-function-type': 'off',
105
+ '@stylistic/max-len': ['error', {
106
+ code: 130,
107
+ tabWidth: 2,
108
+ ignoreComments: true,
109
+ ignoreTrailingComments: true,
110
+ ignoreUrls: true,
111
+ ignoreStrings: true,
112
+ ignoreTemplateLiterals: true,
113
+ ignoreRegExpLiterals: true,
114
+ }],
115
+ '@stylistic/arrow-parens': ['error', 'as-needed'],
116
+ '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
117
+ '@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
118
+ '@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
119
+ '@stylistic/keyword-spacing': ['error', { overrides: {
120
+ this: { before: true },
121
+ } }],
122
+ '@stylistic/indent': ['error', 2, {
123
+ SwitchCase: 1,
124
+ VariableDeclarator: 'first',
125
+ outerIIFEBody: 1,
126
+ MemberExpression: 1,
127
+ FunctionDeclaration: { body: 1, parameters: 1 },
128
+ FunctionExpression: { body: 1, parameters: 1 },
129
+ StaticBlock: { body: 1 },
130
+ CallExpression: { arguments: 1 },
131
+ ArrayExpression: 1,
132
+ ObjectExpression: 1,
133
+ ImportDeclaration: 1,
134
+ flatTernaryExpressions: true,
135
+ offsetTernaryExpressions: true,
136
+ }],
116
137
  };
117
-
118
- module.exports = rules;
@@ -0,0 +1,4 @@
1
+ export const rulesVue = {
2
+ 'vue/multi-word-component-names': 'off',
3
+ 'vue/prefer-import-from-vue': 'off',
4
+ };
package/front/eslint.js CHANGED
@@ -1,37 +1,107 @@
1
- const rules = require('../common/rules.js');
1
+ import antfu from '@antfu/eslint-config';
2
+ import globals from 'globals';
3
+ import { rules } from '../common/rules.js';
4
+ import { rulesVue } from '../common/rulesVue.js';
2
5
 
3
- module.exports = {
4
- extends: ['plugin:@typescript-eslint/recommended', 'plugin:vue/vue3-essential', 'prettier'],
5
- plugins: ['@typescript-eslint', 'vue', 'prettier'],
6
- parserOptions: {
7
- parser: require.resolve('@typescript-eslint/parser'),
8
- extraFileExtensions: ['.vue'],
9
- },
10
- rules,
11
- env: {
12
- browser: true,
13
- es2021: true,
14
- node: true,
15
- },
16
- globals: {
17
- ga: 'readonly', // Google Analytics
18
- cordova: 'readonly',
19
- __statics: 'readonly',
20
- __QUASAR_SSR__: 'readonly',
21
- __QUASAR_SSR_SERVER__: 'readonly',
22
- __QUASAR_SSR_CLIENT__: 'readonly',
23
- __QUASAR_SSR_PWA__: 'readonly',
24
- process: 'readonly',
25
- Capacitor: 'readonly',
26
- chrome: 'readonly',
27
- // $: true,
28
- // util: true,
29
- // env: true,
30
- // App: true,
31
- // getApp: true,
32
- // Page: true,
33
- // wx: true,
34
- // define: true,
35
- Proxy: true,
36
- },
37
- };
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
+ languageOptions: {
21
+ globals: {
22
+ ...globals.node,
23
+ ...globals.jest,
24
+ },
25
+ },
26
+ }, {
27
+ files: ['**/*.vue'],
28
+ rules: Object.assign({}, rules, rulesVue),
29
+ languageOptions: {
30
+ globals: {
31
+ ...globals.browser,
32
+ ...globals.jest,
33
+ ga: 'readonly', // Google Analytics
34
+ cordova: 'readonly',
35
+ __statics: 'readonly',
36
+ __QUASAR_SSR__: 'readonly',
37
+ __QUASAR_SSR_SERVER__: 'readonly',
38
+ __QUASAR_SSR_CLIENT__: 'readonly',
39
+ __QUASAR_SSR_PWA__: 'readonly',
40
+ process: 'readonly',
41
+ Capacitor: 'readonly',
42
+ chrome: 'readonly',
43
+ },
44
+ },
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
+ // ];
package/front/prettier.js CHANGED
@@ -1,3 +1,3 @@
1
- const config = require('../api/prettier.js');
1
+ import config from '../api/prettier.js';
2
2
 
3
- module.exports = config;
3
+ export default config;
@@ -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,7 +1,8 @@
1
1
  {
2
2
  "name": "@cabloy/lint",
3
- "version": "4.0.20",
4
- "description": "Node Style Guide for EggBorn/Cabloy.",
3
+ "type": "module",
4
+ "version": "5.0.1",
5
+ "description": "Node Style Guide for Cabloy.",
5
6
  "publishConfig": {
6
7
  "access": "public"
7
8
  },
@@ -11,15 +12,13 @@
11
12
  "front"
12
13
  ],
13
14
  "dependencies": {
14
- "@typescript-eslint/eslint-plugin": "^7.8.0",
15
- "@typescript-eslint/parser": "^7.8.0",
16
- "eslint": "^8.57.0",
17
- "eslint-config-prettier": "^9.1.0",
18
- "eslint-plugin-jsdoc": "^48.2.4",
19
- "eslint-plugin-node": "^11.1.0",
20
- "eslint-plugin-prettier": "^5.1.3",
21
- "eslint-plugin-vue": "9.26.0",
22
- "prettier": "^3.2.5"
23
- },
24
- "gitHead": "2d40c063c115b230fdbc89f5a78b4412ebd0dfc9"
15
+ "@antfu/eslint-config": "^4.2.1",
16
+ "@eslint/json": "^0.10.0",
17
+ "@stylistic/eslint-plugin": "^3.1.0",
18
+ "@typescript-eslint/parser": "^8.24.0",
19
+ "eslint-plugin-vue": "^9.32.0",
20
+ "globals": "^15.15.0",
21
+ "typescript-eslint": "^8.24.0",
22
+ "vue-eslint-parser": "^9.4.3"
23
+ }
25
24
  }