@w5s/eslint-config 1.0.0-alpha.8 → 1.0.0

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.
Files changed (58) hide show
  1. package/README.md +7 -7
  2. package/es.js +1 -20
  3. package/ignore.js +1 -0
  4. package/index.js +28 -14
  5. package/jest.js +15 -2
  6. package/json.js +8 -6
  7. package/lib/_rule.d.ts +2 -0
  8. package/lib/_rule.js +7 -0
  9. package/lib/es/base.d.ts +4 -0
  10. package/lib/es/base.js +68 -0
  11. package/lib/es/import.d.ts +3 -0
  12. package/lib/es/import.js +57 -0
  13. package/lib/es/jsdoc.d.ts +3 -0
  14. package/lib/es/jsdoc.js +20 -0
  15. package/lib/es/promise.d.ts +3 -0
  16. package/lib/es/promise.js +12 -0
  17. package/lib/es/unicorn.d.ts +3 -0
  18. package/lib/es/unicorn.js +73 -0
  19. package/lib/es.d.ts +3 -0
  20. package/lib/es.js +15 -0
  21. package/lib/ignore.d.ts +3 -0
  22. package/lib/ignore.js +40 -0
  23. package/lib/jest.d.ts +3 -0
  24. package/lib/jest.js +57 -0
  25. package/lib/jsonc.d.ts +3 -0
  26. package/lib/jsonc.js +183 -0
  27. package/lib/prettier.d.ts +3 -0
  28. package/lib/prettier.js +43 -0
  29. package/lib/typescript.d.ts +3 -0
  30. package/lib/typescript.js +248 -0
  31. package/lib/yml.d.ts +3 -0
  32. package/lib/yml.js +7 -0
  33. package/package.json +58 -39
  34. package/src/_rule.ts +5 -0
  35. package/src/es/base.ts +80 -0
  36. package/src/es/import.ts +61 -0
  37. package/src/es/jsdoc.ts +22 -0
  38. package/src/es/promise.ts +13 -0
  39. package/src/es/unicorn.ts +75 -0
  40. package/src/es.ts +18 -0
  41. package/src/ignore.ts +41 -0
  42. package/src/jest.ts +61 -0
  43. package/src/jsonc.ts +187 -0
  44. package/src/prettier.ts +47 -0
  45. package/{rules/typescript.js → src/typescript.ts} +112 -93
  46. package/src/yml.ts +8 -0
  47. package/ts.js +12 -33
  48. package/yml.js +9 -0
  49. package/functional.js +0 -51
  50. package/react.js +0 -10
  51. package/rules/_rule.js +0 -78
  52. package/rules/base.js +0 -45
  53. package/rules/import.js +0 -23
  54. package/rules/jest.js +0 -55
  55. package/rules/jsdoc.js +0 -20
  56. package/rules/prettier.js +0 -14
  57. package/rules/react.js +0 -176
  58. package/rules/unicorn.js +0 -61
package/README.md CHANGED
@@ -1,17 +1,17 @@
1
- <!-- AUTO-GENERATED-CONTENT:START (PKGJSON:template=# W5s ESLint configuration _(${name})_) -->
1
+ <!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=# W5s ESLint configuration _(${name})_) -->
2
2
  # W5s ESLint configuration _(@w5s/eslint-config)_
3
3
  <!-- AUTO-GENERATED-CONTENT:END -->
4
4
 
5
5
  [![NPM Version][package-version-svg]][package-url]
6
6
  [![License][license-image]][license-url]
7
7
 
8
- <!-- AUTO-GENERATED-CONTENT:START (PKGJSON:template=> ${description}&unknownTxt= ) -->
8
+ <!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=> ${description}&unknownTxt= ) -->
9
9
  > ESLint configuration presets
10
10
  <!-- AUTO-GENERATED-CONTENT:END -->
11
11
 
12
12
  ## Installation
13
13
 
14
- <!-- AUTO-GENERATED-CONTENT:START (PKGJSON:template=```console\nnpm install --save-dev ${name}\n```) -->
14
+ <!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=```console\nnpm install --save-dev ${name}\n```) -->
15
15
  ```console
16
16
  npm install --save-dev @w5s/eslint-config
17
17
  ```
@@ -67,19 +67,19 @@ For most kind of project, just edit `eslintrc.json` and cherry pick only configu
67
67
  - `@w5s/eslint-config/ts`: for typescript files
68
68
 
69
69
  ## License
70
- <!-- AUTO-GENERATED-CONTENT:START (PKGJSON:template=[${license}][license-url] © ${author}) -->
70
+ <!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[${license}][license-url] © ${author}) -->
71
71
  [MIT][license-url] © Julien Polo <julien.polo@gmail.com>
72
72
  <!-- AUTO-GENERATED-CONTENT:END -->
73
73
 
74
74
  <!-- VARIABLES -->
75
75
 
76
- <!-- AUTO-GENERATED-CONTENT:START (PKGJSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square) -->
76
+ <!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square) -->
77
77
  [package-version-svg]: https://img.shields.io/npm/v/@w5s/eslint-config.svg?style=flat-square
78
78
  <!-- AUTO-GENERATED-CONTENT:END -->
79
- <!-- AUTO-GENERATED-CONTENT:START (PKGJSON:template=[package-url]: https://www.npmjs.com/package/${name}) -->
79
+ <!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}) -->
80
80
  [package-url]: https://www.npmjs.com/package/@w5s/eslint-config
81
81
  <!-- AUTO-GENERATED-CONTENT:END -->
82
- <!-- AUTO-GENERATED-CONTENT:START (PKGJSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square) -->
82
+ <!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square) -->
83
83
  [license-image]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square
84
84
  <!-- AUTO-GENERATED-CONTENT:END -->
85
85
  [license-url]: ../../LICENSE
package/es.js CHANGED
@@ -1,23 +1,4 @@
1
1
  // http://eslint.org/docs/user-guide/configuring
2
2
  module.exports = {
3
- extends: [
4
- require.resolve('./rules/base'),
5
- require.resolve('./rules/jsdoc'),
6
- require.resolve('./rules/import'),
7
- require.resolve('./rules/unicorn'),
8
- 'prettier',
9
- require.resolve('./rules/prettier'),
10
- ],
11
- parser: '@babel/eslint-parser',
12
- parserOptions: {
13
- babelOptions: {
14
- plugins: ['@babel/plugin-syntax-class-properties', '@babel/plugin-syntax-jsx'],
15
- },
16
- ecmaFeatures: {
17
- jsx: true,
18
- },
19
- ecmaVersion: 2020,
20
- requireConfigFile: false,
21
- sourceType: 'module',
22
- },
3
+ extends: [require.resolve('./lib/es.js'), require.resolve('./lib/prettier.js')],
23
4
  };
package/ignore.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./lib/ignore.js');
package/index.js CHANGED
@@ -1,19 +1,33 @@
1
1
  // http://eslint.org/docs/user-guide/configuring
2
+ /**
3
+ * @param {string} name
4
+ */
5
+ function tryResolve(name) {
6
+ try {
7
+ require.resolve(name);
8
+ return true;
9
+ } catch {
10
+ return false;
11
+ }
12
+ }
13
+
14
+ /**
15
+ * @template T
16
+ * @param {boolean} condition
17
+ * @param {() => T} getValue
18
+ */
19
+ function includeIf(condition, getValue) {
20
+ return condition ? [getValue()] : [];
21
+ }
22
+
2
23
  module.exports = {
3
- extends: [require.resolve('./es'), require.resolve('./react'), require.resolve('./json')],
4
- overrides: [
5
- {
6
- extends: [require.resolve('./ts')],
7
- files: ['*.+(ts|tsx)'],
8
- },
9
- {
10
- extends: [require.resolve('./jest')],
11
- files: [
12
- '**/__mocks__/**/*.+(ts|tsx|js|jsx)',
13
- '**/__tests__/**/*.+(ts|tsx|js|jsx)',
14
- '**/?(*.)+(spec|test).+(ts|tsx|js|jsx)',
15
- ],
16
- },
24
+ extends: [
25
+ require.resolve('./ignore.js'),
26
+ require.resolve('./es.js'),
27
+ ...includeIf(tryResolve('typescript'), () => require.resolve('./ts.js')),
28
+ require.resolve('./json.js'),
29
+ require.resolve('./yml.js'),
30
+ require.resolve('./jest.js'),
17
31
  ],
18
32
  root: true,
19
33
  };
package/jest.js CHANGED
@@ -1,4 +1,17 @@
1
- // http://eslint.org/docs/user-guide/configuring
1
+ // eslint-disable-next-line import/no-unresolved
2
+ const { EXTENSIONS_WITHOUT_DOT } = require('@w5s/dev');
3
+
4
+ const extensions = EXTENSIONS_WITHOUT_DOT.join('|');
5
+
2
6
  module.exports = {
3
- extends: [require.resolve('./rules/jest')],
7
+ overrides: [
8
+ {
9
+ extends: [require.resolve('./lib/jest.js')],
10
+ files: [
11
+ `**/__mocks__/**/*.+(${extensions})`,
12
+ `**/__tests__/**/*.+(${extensions})`,
13
+ `**/?(*.)+(spec|test).+(${extensions})`,
14
+ ],
15
+ },
16
+ ],
4
17
  };
package/json.js CHANGED
@@ -1,8 +1,10 @@
1
+ /* cspell:disable */
2
+ // https://github.com/keithamus/sort-package-json/blob/master/defaultRules.md
1
3
  module.exports = {
2
- plugins: ['json-format'],
3
- settings: {
4
- 'json/ignore-files': ['**/package-lock.json'],
5
- 'json/json-with-comments-files': ['**/tsconfig.json', '.vscode/**'],
6
- 'json/sort-package-json': 'standard',
7
- },
4
+ overrides: [
5
+ {
6
+ extends: [require.resolve('./lib/jsonc.js')],
7
+ files: ['*.json', '*.json5', '*.jsonc'],
8
+ },
9
+ ],
8
10
  };
package/lib/_rule.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function fixme(_status: Linter.RuleLevel | [Linter.RuleLevel, ...any[]] | undefined): "off";
package/lib/_rule.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fixme = void 0;
4
+ function fixme(_status) {
5
+ return 'off';
6
+ }
7
+ exports.fixme = fixme;
@@ -0,0 +1,4 @@
1
+ import type eslint from 'eslint';
2
+ import '@rushstack/eslint-patch/modern-module-resolution.js';
3
+ declare const config: eslint.Linter.Config;
4
+ export = config;
package/lib/es/base.js ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const dev_1 = require("@w5s/dev");
6
+ // Fix eslint shareable config (https://github.com/eslint/eslint/issues/3458)
7
+ // @ts-ignore No typing available
8
+ require("@rushstack/eslint-patch/modern-module-resolution.js");
9
+ // @ts-ignore No typing available
10
+ const best_practices_1 = __importDefault(require("eslint-config-airbnb-base/rules/best-practices"));
11
+ // @ts-ignore No typing available
12
+ const errors_1 = __importDefault(require("eslint-config-airbnb-base/rules/errors"));
13
+ // @ts-ignore No typing available
14
+ const es6_1 = __importDefault(require("eslint-config-airbnb-base/rules/es6"));
15
+ // @ts-ignore No typing available
16
+ const node_1 = __importDefault(require("eslint-config-airbnb-base/rules/node"));
17
+ // @ts-ignore No typing available
18
+ const strict_1 = __importDefault(require("eslint-config-airbnb-base/rules/strict"));
19
+ // @ts-ignore No typing available
20
+ const style_1 = __importDefault(require("eslint-config-airbnb-base/rules/style"));
21
+ // @ts-ignore No typing available
22
+ const variables_1 = __importDefault(require("eslint-config-airbnb-base/rules/variables"));
23
+ const baseConfig = dev_1.ESLintConfig.concat(best_practices_1.default, errors_1.default, es6_1.default, node_1.default, strict_1.default, style_1.default, variables_1.default);
24
+ const config = dev_1.ESLintConfig.concat(baseConfig,
25
+ // overrides
26
+ {
27
+ env: {
28
+ [`es${dev_1.ECMA_VERSION}`]: true,
29
+ },
30
+ globals: {
31
+ __DEV__: 'readonly',
32
+ __PROD__: 'readonly',
33
+ __TEST__: 'readonly',
34
+ },
35
+ parser: 'espree',
36
+ parserOptions: {
37
+ ecmaFeatures: {
38
+ jsx: true,
39
+ },
40
+ ecmaVersion: dev_1.ECMA_VERSION,
41
+ sourceType: 'module',
42
+ },
43
+ reportUnusedDisableDirectives: true,
44
+ rules: {
45
+ // Annoying because it is not always wanted
46
+ 'default-case': 'off',
47
+ // We do not want console.* in production. Disable this rule on a per line basis if needed
48
+ 'no-console': 'error',
49
+ // Often useful in jsx
50
+ 'no-nested-ternary': 'off',
51
+ // Too strict, for pure code prefer the functional plugin
52
+ 'no-param-reassign': ['error', { props: false }],
53
+ // Allow for-of syntax
54
+ // @ts-ignore No typing available
55
+ 'no-restricted-syntax': baseConfig.rules['no-restricted-syntax'].filter(
56
+ // @ts-ignore No typing available
57
+ ({ selector }) => selector !== 'ForOfStatement'),
58
+ // underscore is often used (mongodb, etc)
59
+ 'no-underscore-dangle': 'off',
60
+ // Ignore underscore case arguments
61
+ 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
62
+ // Allow in some cases https://github.com/airbnb/javascript/issues/1089#issuecomment-1024351821
63
+ 'no-use-before-define': ['error', 'nofunc'],
64
+ // Allow statements, to be compatible with '@typescript-eslint/no-floating-promises' fix
65
+ 'no-void': ['error', { allowAsStatement: true }],
66
+ },
67
+ });
68
+ module.exports = config;
@@ -0,0 +1,3 @@
1
+ import type eslint from 'eslint';
2
+ declare const config: eslint.Linter.Config;
3
+ export = config;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const dev_1 = require("@w5s/dev");
6
+ // @ts-ignore airbnb is not typed
7
+ const imports_1 = __importDefault(require("eslint-config-airbnb-base/rules/imports"));
8
+ const _rule_js_1 = require("../_rule.js");
9
+ // @see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
10
+ const config = dev_1.ESLintConfig.concat(imports_1.default,
11
+ // Overrides
12
+ {
13
+ rules: {
14
+ 'import/extensions': [
15
+ 'error',
16
+ 'ignorePackages',
17
+ {
18
+ // js: 'never',
19
+ // jsx: 'never',
20
+ // mjs: 'never',
21
+ },
22
+ ],
23
+ 'import/no-deprecated': 'off',
24
+ 'import/no-extraneous-dependencies': [
25
+ 'error',
26
+ {
27
+ ...imports_1.default.rules['import/no-extraneous-dependencies'][1],
28
+ devDependencies: [
29
+ ...imports_1.default.rules['import/no-extraneous-dependencies'][1].devDependencies,
30
+ '**/*.config.[jt]s?(x)',
31
+ '**/*.config.cjs',
32
+ ],
33
+ },
34
+ ],
35
+ 'import/no-named-as-default': 'off',
36
+ 'import/no-unused-modules': 'off',
37
+ 'import/prefer-default-export': 'off',
38
+ 'import/unambiguous': (0, _rule_js_1.fixme)('off'), // Disable because proposal still in progress
39
+ },
40
+ settings: {
41
+ 'import/extensions': dev_1.EXTENSIONS,
42
+ // Resolve type definition packages
43
+ 'import/external-module-folders': ['node_modules', 'node_modules/@types'],
44
+ 'import/ignore': [...dev_1.IGNORE_LIST, dev_1.EXTENSIONS_RESOURCES_REGEX],
45
+ // Apply special parsing for TypeScript files
46
+ 'import/parsers': {
47
+ '@typescript-eslint/parser': dev_1.EXTENSIONS.filter((ext) => !ext.includes('js')),
48
+ },
49
+ // Append 'ts' extensions to Airbnb 'import/resolver' setting
50
+ 'import/resolver': {
51
+ node: {
52
+ extensions: [...dev_1.EXTENSIONS, '.json'],
53
+ },
54
+ },
55
+ },
56
+ });
57
+ module.exports = config;
@@ -0,0 +1,3 @@
1
+ import type eslint from 'eslint';
2
+ declare const config: eslint.Linter.Config;
3
+ export = config;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ const config = {
3
+ extends: ['plugin:jsdoc/recommended'],
4
+ plugins: ['jsdoc'],
5
+ rules: {
6
+ 'jsdoc/no-undefined-types': 'off',
7
+ 'jsdoc/require-hyphen-before-param-description': ['warn', 'always'],
8
+ 'jsdoc/require-jsdoc': 'off',
9
+ 'jsdoc/require-param-description': 'off',
10
+ 'jsdoc/require-returns': 'off',
11
+ 'jsdoc/valid-types': 'off',
12
+ strict: ['error', 'safe'],
13
+ },
14
+ settings: {
15
+ jsdoc: {
16
+ mode: 'typescript',
17
+ },
18
+ },
19
+ };
20
+ module.exports = config;
@@ -0,0 +1,3 @@
1
+ import type eslint from 'eslint';
2
+ declare const config: eslint.Linter.Config;
3
+ export = config;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ const dev_1 = require("@w5s/dev");
3
+ const _rule_js_1 = require("../_rule.js");
4
+ const config = dev_1.ESLintConfig.concat({
5
+ extends: ['plugin:promise/recommended'],
6
+ plugins: ['promise'],
7
+ rules: {
8
+ 'promise/prefer-await-to-callbacks': (0, _rule_js_1.fixme)('error'),
9
+ 'promise/prefer-await-to-then': 'error',
10
+ },
11
+ });
12
+ module.exports = config;
@@ -0,0 +1,3 @@
1
+ import type eslint from 'eslint';
2
+ declare const config: eslint.Linter.Config;
3
+ export = config;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const dev_1 = require("@w5s/dev");
6
+ // @ts-ignore unicorn config is not typed
7
+ const recommended_js_1 = __importDefault(require("eslint-plugin-unicorn/configs/recommended.js"));
8
+ const config = dev_1.ESLintConfig.concat(recommended_js_1.default, {
9
+ // extends: ['plugin:unicorn/recommended'],
10
+ plugins: ['unicorn'],
11
+ rules: {
12
+ 'unicode-bom': ['error', 'never'],
13
+ 'unicorn/better-regex': 'error',
14
+ 'unicorn/catch-error-name': ['error', { name: 'error' }],
15
+ 'unicorn/custom-error-definition': 'error',
16
+ 'unicorn/error-message': 'error',
17
+ 'unicorn/explicit-length-check': ['error', { 'non-zero': 'greater-than' }],
18
+ 'unicorn/filename-case': 'off',
19
+ 'unicorn/import-index': 'off',
20
+ 'unicorn/new-for-builtins': 'off',
21
+ 'unicorn/no-abusive-eslint-disable': 'error',
22
+ 'unicorn/no-array-instanceof': 'error',
23
+ 'unicorn/no-console-spaces': 'off',
24
+ 'unicorn/no-fn-reference-in-iterator': 'off',
25
+ 'unicorn/no-for-loop': 'error',
26
+ 'unicorn/no-hex-escape': 'error',
27
+ 'unicorn/no-new-buffer': 'error',
28
+ 'unicorn/no-null': 'off',
29
+ 'unicorn/no-process-exit': 'off',
30
+ 'unicorn/no-unreadable-array-destructuring': 'off',
31
+ 'unicorn/no-unsafe-regex': 'error',
32
+ 'unicorn/no-unused-properties': 'warn',
33
+ 'unicorn/no-useless-undefined': 'off',
34
+ 'unicorn/no-zero-fractions': 'error',
35
+ 'unicorn/number-literal-case': 'error',
36
+ 'unicorn/prefer-add-event-listener': 'off',
37
+ 'unicorn/prefer-event-key': 'error',
38
+ 'unicorn/prefer-exponentiation-operator': 'error',
39
+ 'unicorn/prefer-flat-map': 'error',
40
+ 'unicorn/prefer-includes': 'error',
41
+ 'unicorn/prefer-node-append': 'error',
42
+ 'unicorn/prefer-node-remove': 'error',
43
+ 'unicorn/prefer-number-properties': 'error',
44
+ 'unicorn/prefer-query-selector': 'error',
45
+ 'unicorn/prefer-set-has': 'off',
46
+ 'unicorn/prefer-spread': 'off',
47
+ 'unicorn/prefer-starts-ends-with': 'error',
48
+ 'unicorn/prefer-text-content': 'error',
49
+ 'unicorn/prefer-type-error': 'error',
50
+ 'unicorn/throw-new-error': 'error',
51
+ },
52
+ }, {
53
+ overrides: [
54
+ {
55
+ files: ['**/*.config.cjs', '**/*.config.js'],
56
+ rules: {
57
+ 'unicorn/prefer-module': 'off',
58
+ },
59
+ },
60
+ ],
61
+ rules: {
62
+ 'unicorn/consistent-destructuring': 'off',
63
+ 'unicorn/consistent-function-scoping': 'off',
64
+ 'unicorn/no-array-callback-reference': 'off',
65
+ 'unicorn/no-array-for-each': 'off',
66
+ 'unicorn/no-array-method-this-argument': 'off',
67
+ 'unicorn/no-array-reduce': 'off',
68
+ 'unicorn/no-object-as-default-parameter': 'off',
69
+ 'unicorn/prefer-default-parameters': 'off',
70
+ 'unicorn/prevent-abbreviations': 'off', // This rule is so dangerous : it potentially break code while fixing in many cases !!
71
+ },
72
+ });
73
+ module.exports = config;
package/lib/es.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type eslint from 'eslint';
2
+ declare const config: eslint.Linter.Config;
3
+ export = config;
package/lib/es.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const dev_1 = require("@w5s/dev");
6
+ const base_js_1 = __importDefault(require("./es/base.js"));
7
+ const promise_js_1 = __importDefault(require("./es/promise.js"));
8
+ const jsdoc_js_1 = __importDefault(require("./es/jsdoc.js"));
9
+ const import_js_1 = __importDefault(require("./es/import.js"));
10
+ const unicorn_js_1 = __importDefault(require("./es/unicorn.js"));
11
+ // import prettierConfig from './prettier.js';
12
+ const config = dev_1.ESLintConfig.concat(base_js_1.default, promise_js_1.default, jsdoc_js_1.default, import_js_1.default, unicorn_js_1.default
13
+ // prettierConfig
14
+ );
15
+ module.exports = config;
@@ -0,0 +1,3 @@
1
+ import type eslint from 'eslint';
2
+ declare const config: eslint.Linter.Config;
3
+ export = config;
package/lib/ignore.js ADDED
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const node_fs_1 = require("node:fs");
6
+ const find_up_1 = __importDefault(require("find-up"));
7
+ const parse_gitignore_1 = __importDefault(require("parse-gitignore"));
8
+ const getGitignore = () => {
9
+ const found = find_up_1.default.sync('.gitignore');
10
+ if (found != null) {
11
+ return parse_gitignore_1.default.parse((0, node_fs_1.readFileSync)(found)).patterns;
12
+ }
13
+ return [];
14
+ };
15
+ const config = {
16
+ ignorePatterns: [
17
+ '!.*',
18
+ '.yarn',
19
+ '.common/',
20
+ '.config/package-lock.json',
21
+ '.config/yarn.lock',
22
+ '.go/',
23
+ '.modules/',
24
+ '.pnpm-store/',
25
+ '.venv/',
26
+ 'deprecated/',
27
+ 'angular.json',
28
+ 'esbuild.js',
29
+ 'package-lock.json',
30
+ 'pnpm-lock.yaml',
31
+ 'slim.report.json',
32
+ 'test-output/',
33
+ 'venv/',
34
+ 'yarn.lock',
35
+ '_generated_/',
36
+ '*.toml',
37
+ ...getGitignore(),
38
+ ],
39
+ };
40
+ module.exports = config;
package/lib/jest.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type eslint from 'eslint';
2
+ declare const config: eslint.Linter.Config;
3
+ export = config;
package/lib/jest.js ADDED
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ const dev_1 = require("@w5s/dev");
3
+ const config = dev_1.ESLintConfig.concat({
4
+ env: {
5
+ 'jest/globals': true,
6
+ },
7
+ extends: ['plugin:jest/recommended'],
8
+ globals: {
9
+ context: true,
10
+ },
11
+ plugins: ['jest'],
12
+ rules: {
13
+ 'jest/consistent-test-it': 'error',
14
+ 'jest/expect-expect': 'off',
15
+ 'jest/no-alias-methods': 'error',
16
+ 'jest/prefer-spy-on': 'error',
17
+ 'jest/prefer-to-contain': 'error',
18
+ 'jest/valid-title': ['error', { ignoreTypeOfDescribeName: true }],
19
+ },
20
+ settings: {
21
+ jest: {
22
+ // Compatibility with mocha, cypress, etc.
23
+ globalAliases: {
24
+ describe: ['context'],
25
+ fdescribe: ['fcontext'],
26
+ xdescribe: ['xcontext'],
27
+ },
28
+ version: 'latest',
29
+ },
30
+ },
31
+ },
32
+ /**
33
+ * Unicorn less strict to help writing tests
34
+ */
35
+ {
36
+ rules: {
37
+ 'unicorn/consistent-function-scoping': 'off',
38
+ 'unicorn/no-useless-undefined': 'off',
39
+ 'unicorn/prefer-module': 'off',
40
+ },
41
+ },
42
+ /**
43
+ * Typescript config is set to be less strict because we often have "hack", "mock" in tests
44
+ */
45
+ {
46
+ rules: {
47
+ '@typescript-eslint/naming-convention': 'off',
48
+ '@typescript-eslint/no-non-null-assertion': 'off',
49
+ '@typescript-eslint/no-unsafe-assignment': 'off',
50
+ '@typescript-eslint/no-unsafe-call': 'off',
51
+ '@typescript-eslint/no-unsafe-member-access': 'off',
52
+ '@typescript-eslint/no-unsafe-return': 'off',
53
+ '@typescript-eslint/restrict-template-expressions': 'off',
54
+ '@typescript-eslint/unbound-method': 'off',
55
+ },
56
+ });
57
+ module.exports = config;
package/lib/jsonc.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type eslint from 'eslint';
2
+ declare const config: eslint.Linter.Config;
3
+ export = config;