@cedarjs/eslint-config 5.0.3 → 5.0.4-next.167

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/index.mjs CHANGED
@@ -6,7 +6,6 @@ import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'
6
6
  import globals from 'globals'
7
7
 
8
8
  import {
9
- getCommonPlugins,
10
9
  getApiSideDefaultBabelConfig,
11
10
  getWebSideDefaultBabelConfig,
12
11
  } from '@cedarjs/babel-config'
@@ -16,9 +15,11 @@ import { getConfig, isTypeScriptProject } from '@cedarjs/project-config'
16
15
  import sharedConfigs from './shared.mjs'
17
16
 
18
17
  // Note: This config is async to support getConfig()
18
+ /** @returns {Promise<import('eslint').Linter.FlatConfig[]>} */
19
19
  export default async function createConfig() {
20
20
  const config = await getConfig()
21
21
 
22
+ /** @returns {import('@babel/core').TransformOptions} */
22
23
  const getProjectBabelOptions = () => {
23
24
  // We can't nest the web overrides inside the overrides block
24
25
  // So we just take it out and put it as a separate item
@@ -33,7 +34,7 @@ export default async function createConfig() {
33
34
  getApiSideDefaultBabelConfig()
34
35
 
35
36
  return {
36
- plugins: getCommonPlugins(),
37
+ plugins: [],
37
38
  overrides: [
38
39
  {
39
40
  test: ['./api/', './scripts/'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/eslint-config",
3
- "version": "5.0.3",
3
+ "version": "5.0.4-next.167",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -9,31 +9,17 @@
9
9
  "license": "MIT",
10
10
  "exports": {
11
11
  ".": {
12
- "import": {
13
- "types": "./dist/index.d.mts",
14
- "default": "./index.mjs"
15
- },
16
- "require": {
17
- "types": "./dist/index.d.ts",
18
- "default": "./index.js"
19
- }
12
+ "types": "./dist/index.d.mts",
13
+ "default": "./index.mjs"
20
14
  },
21
15
  "./shared": {
22
- "import": {
23
- "types": "./dist/shared.d.mts",
24
- "default": "./shared.mjs"
25
- },
26
- "require": {
27
- "types": "./dist/shared.d.ts",
28
- "default": "./shared.js"
29
- }
16
+ "types": "./dist/shared.d.mts",
17
+ "default": "./shared.mjs"
30
18
  }
31
19
  },
32
- "types": "./dist/index.d.ts",
20
+ "types": "./dist/index.d.mts",
33
21
  "files": [
34
- "index.js",
35
22
  "index.mjs",
36
- "shared.js",
37
23
  "shared.mjs",
38
24
  "dist"
39
25
  ],
@@ -46,18 +32,13 @@
46
32
  "@babel/core": "^7.26.10",
47
33
  "@babel/eslint-parser": "7.29.7",
48
34
  "@babel/eslint-plugin": "7.29.7",
49
- "@cedarjs/babel-config": "5.0.3",
50
- "@cedarjs/eslint-plugin": "5.0.3",
51
- "@cedarjs/internal": "5.0.3",
52
- "@cedarjs/project-config": "5.0.3",
35
+ "@cedarjs/babel-config": "5.0.4-next.167",
36
+ "@cedarjs/eslint-plugin": "5.0.4-next.167",
37
+ "@cedarjs/project-config": "5.0.4-next.167",
53
38
  "@eslint/js": "8.57.1",
54
- "@typescript-eslint/eslint-plugin": "8.60.1",
55
- "@typescript-eslint/parser": "8.60.1",
56
39
  "eslint": "8.57.1",
57
40
  "eslint-config-prettier": "10.1.8",
58
- "eslint-import-resolver-babel-module": "5.3.2",
59
- "eslint-plugin-babel": "5.3.1",
60
- "eslint-plugin-import-x": "4.16.2",
41
+ "eslint-plugin-import-x": "4.17.1",
61
42
  "eslint-plugin-jest-dom": "5.5.0",
62
43
  "eslint-plugin-jsx-a11y": "6.10.2",
63
44
  "eslint-plugin-prettier": "5.5.6",
@@ -67,7 +48,6 @@
67
48
  "typescript-eslint": "8.60.1"
68
49
  },
69
50
  "devDependencies": {
70
- "@babel/cli": "7.29.7",
71
51
  "typescript": "5.9.3"
72
52
  },
73
53
  "peerDependencies": {
package/shared.mjs CHANGED
@@ -26,7 +26,10 @@ import tseslint from 'typescript-eslint'
26
26
 
27
27
  import cedarjsPlugin from '@cedarjs/eslint-plugin'
28
28
 
29
- export default [
29
+ // Using a const here rather than directly doing `export default [...]` becuase
30
+ // otherwise the JSDoc below wouldn't attach it's type info properly
31
+ /** @type {import('eslint').Linter.FlatConfig[]} */
32
+ const sharedConfigs = [
30
33
  // Base recommended config
31
34
  js.configs.recommended,
32
35
 
@@ -270,3 +273,5 @@ export default [
270
273
  },
271
274
  },
272
275
  ]
276
+
277
+ export default sharedConfigs
package/dist/index.d.ts DELETED
@@ -1,144 +0,0 @@
1
- declare const plugins_1: any[];
2
- export const rules: {
3
- 'react-compiler/react-compiler': number;
4
- };
5
- declare let _extends: (string | false)[];
6
- export declare let ignorePatterns: string[];
7
- export declare namespace parserOptions {
8
- let requireConfigFile: boolean;
9
- namespace babelOptions {
10
- let plugins: [string, import("@babel/core").PluginOptions][];
11
- let overrides: ({
12
- presets: import("@babel/core").PluginItem[] | null | undefined;
13
- plugins: ([import("@babel/core").PluginTarget, import("@babel/core").PluginOptions, string | undefined] | [import("@babel/core").PluginTarget, import("@babel/core").PluginOptions])[];
14
- extends: string | undefined;
15
- babelrc: boolean;
16
- ignore: string[];
17
- test: string[];
18
- } | {
19
- presets: ((string | undefined)[] | (string | object)[])[];
20
- plugins: import("@babel/core").TransformOptions[];
21
- extends: string | undefined;
22
- babelrc: boolean;
23
- ignore: string[];
24
- test: string[];
25
- })[];
26
- }
27
- }
28
- declare let overrides_1: ({
29
- files: string[];
30
- rules: {
31
- 'no-undef': string;
32
- 'jsx-a11y/aria-role': (number | {
33
- ignoreNonDOM: boolean;
34
- })[];
35
- '@cedarjs/unsupported-route-components': string;
36
- '@cedarjs/service-type-annotations'?: undefined;
37
- };
38
- env?: undefined;
39
- globals?: undefined;
40
- plugins?: undefined;
41
- } | {
42
- files: string;
43
- env: {
44
- node: boolean;
45
- es6: boolean;
46
- commonjs?: undefined;
47
- browser?: undefined;
48
- 'shared-node-browser'?: undefined;
49
- };
50
- globals: {
51
- gql: string;
52
- context: string;
53
- Promise?: undefined;
54
- React?: undefined;
55
- process?: undefined;
56
- require?: undefined;
57
- mockGraphQLQuery?: undefined;
58
- mockGraphQLMutation?: undefined;
59
- mockCurrentUser?: undefined;
60
- scenario?: undefined;
61
- defineScenario?: undefined;
62
- };
63
- rules?: undefined;
64
- plugins?: undefined;
65
- } | {
66
- files: string[];
67
- plugins: string[];
68
- rules: {
69
- '@cedarjs/service-type-annotations': string;
70
- 'no-undef'?: undefined;
71
- 'jsx-a11y/aria-role'?: undefined;
72
- '@cedarjs/unsupported-route-components'?: undefined;
73
- };
74
- env?: undefined;
75
- globals?: undefined;
76
- } | {
77
- files: string[];
78
- env: {
79
- node: boolean;
80
- commonjs: boolean;
81
- es6?: undefined;
82
- browser?: undefined;
83
- 'shared-node-browser'?: undefined;
84
- };
85
- globals: {
86
- Promise: string;
87
- gql?: undefined;
88
- context?: undefined;
89
- React?: undefined;
90
- process?: undefined;
91
- require?: undefined;
92
- mockGraphQLQuery?: undefined;
93
- mockGraphQLMutation?: undefined;
94
- mockCurrentUser?: undefined;
95
- scenario?: undefined;
96
- defineScenario?: undefined;
97
- };
98
- rules?: undefined;
99
- plugins?: undefined;
100
- } | {
101
- files: string;
102
- env: {
103
- browser: boolean;
104
- es6: boolean;
105
- 'shared-node-browser': boolean;
106
- node?: undefined;
107
- commonjs?: undefined;
108
- };
109
- globals: {
110
- React: string;
111
- gql: string;
112
- process: string;
113
- require: string;
114
- context?: undefined;
115
- Promise?: undefined;
116
- mockGraphQLQuery?: undefined;
117
- mockGraphQLMutation?: undefined;
118
- mockCurrentUser?: undefined;
119
- scenario?: undefined;
120
- defineScenario?: undefined;
121
- };
122
- rules?: undefined;
123
- plugins?: undefined;
124
- } | {
125
- files: string[];
126
- globals: {
127
- mockGraphQLQuery: string;
128
- mockGraphQLMutation: string;
129
- mockCurrentUser: string;
130
- scenario: string;
131
- defineScenario: string;
132
- gql?: undefined;
133
- context?: undefined;
134
- Promise?: undefined;
135
- React?: undefined;
136
- process?: undefined;
137
- require?: undefined;
138
- };
139
- rules?: undefined;
140
- env?: undefined;
141
- plugins?: undefined;
142
- })[];
143
- export { _extends as extends, plugins, overrides_1 as overrides };
144
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":"AAyCA,+BAAkB;AAClB;;EAAgB"}
package/dist/shared.d.ts DELETED
@@ -1,144 +0,0 @@
1
- declare let _extends: string[];
2
- export { _extends as extends };
3
- export declare let parser: string;
4
- export declare let plugins: string[];
5
- export declare let ignorePatterns: string[];
6
- export declare let settings: {
7
- react: {
8
- version: string;
9
- };
10
- 'import/internal-regex': string;
11
- };
12
- export declare let rules: {
13
- '@cedarjs/process-env-computed': string;
14
- 'prettier/prettier': string;
15
- 'no-console': string;
16
- 'prefer-object-spread': string;
17
- 'prefer-spread': string;
18
- 'no-unused-expressions': (string | {
19
- allowShortCircuit: boolean;
20
- allowTernary: boolean;
21
- })[];
22
- 'no-useless-escape': string;
23
- camelcase: (string | {
24
- properties: string;
25
- })[];
26
- 'no-new': string;
27
- 'new-cap': (string | {
28
- newIsCap: boolean;
29
- capIsNew: boolean;
30
- })[];
31
- 'no-unused-vars': (string | {
32
- varsIgnorePattern: string;
33
- argsIgnorePattern: string;
34
- })[];
35
- 'react/prop-types': string;
36
- 'react/display-name': string;
37
- 'react-hooks/exhaustive-deps': string;
38
- 'import/order': (string | {
39
- 'newlines-between': string;
40
- pathGroupsExcludedImportTypes: never[];
41
- groups: string[];
42
- pathGroups: ({
43
- pattern: string;
44
- group: string;
45
- position: string;
46
- patternOptions?: undefined;
47
- } | {
48
- pattern: string;
49
- patternOptions: {
50
- nobrace: boolean;
51
- noglobstar: boolean;
52
- };
53
- group: string;
54
- position: string;
55
- })[];
56
- alphabetize: {
57
- order: string;
58
- caseInsensitive: boolean;
59
- };
60
- })[];
61
- 'no-restricted-imports': (string | {
62
- patterns: {
63
- group: string[];
64
- message: string;
65
- }[];
66
- })[];
67
- };
68
- export declare let overrides: ({
69
- files: string[];
70
- excludedFiles: string[];
71
- rules: {
72
- 'react-hooks/rules-of-hooks': string;
73
- '@typescript-eslint/no-empty-function'?: undefined;
74
- '@typescript-eslint/prefer-function-type'?: undefined;
75
- '@typescript-eslint/no-var-requires'?: undefined;
76
- '@typescript-eslint/no-require-imports'?: undefined;
77
- '@typescript-eslint/no-empty-object-type'?: undefined;
78
- '@typescript-eslint/no-unused-vars'?: undefined;
79
- 'no-restricted-imports'?: undefined;
80
- };
81
- parser?: undefined;
82
- extends?: undefined;
83
- env?: undefined;
84
- } | {
85
- files: string[];
86
- parser: string;
87
- extends: string[];
88
- rules: {
89
- '@typescript-eslint/no-empty-function': string;
90
- '@typescript-eslint/prefer-function-type': string;
91
- '@typescript-eslint/no-var-requires': string;
92
- '@typescript-eslint/no-require-imports': string;
93
- '@typescript-eslint/no-empty-object-type': string;
94
- '@typescript-eslint/no-unused-vars': (string | {
95
- varsIgnorePattern: string;
96
- argsIgnorePattern: string;
97
- })[];
98
- 'react-hooks/rules-of-hooks'?: undefined;
99
- 'no-restricted-imports'?: undefined;
100
- };
101
- excludedFiles?: undefined;
102
- env?: undefined;
103
- } | {
104
- files: string[];
105
- env: {
106
- node: boolean;
107
- es6: boolean;
108
- commonjs: boolean;
109
- jest: boolean;
110
- };
111
- excludedFiles?: undefined;
112
- rules?: undefined;
113
- parser?: undefined;
114
- extends?: undefined;
115
- } | {
116
- files: string[];
117
- env: {
118
- node: boolean;
119
- commonjs: boolean;
120
- jest: boolean;
121
- es6?: undefined;
122
- };
123
- excludedFiles?: undefined;
124
- rules?: undefined;
125
- parser?: undefined;
126
- extends?: undefined;
127
- } | {
128
- files: string[];
129
- rules: {
130
- 'no-restricted-imports': string;
131
- 'react-hooks/rules-of-hooks'?: undefined;
132
- '@typescript-eslint/no-empty-function'?: undefined;
133
- '@typescript-eslint/prefer-function-type'?: undefined;
134
- '@typescript-eslint/no-var-requires'?: undefined;
135
- '@typescript-eslint/no-require-imports'?: undefined;
136
- '@typescript-eslint/no-empty-object-type'?: undefined;
137
- '@typescript-eslint/no-unused-vars'?: undefined;
138
- };
139
- excludedFiles?: undefined;
140
- parser?: undefined;
141
- extends?: undefined;
142
- env?: undefined;
143
- })[];
144
- //# sourceMappingURL=shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../shared.js"],"names":[],"mappings":""}
package/index.js DELETED
@@ -1,142 +0,0 @@
1
- // This is the ESLint configuration used by Cedar projects.
2
- // Shared eslint config (projects and framework) is located in ./shared.js
3
- // Framework main config is in monorepo root ./eslint.config.js
4
-
5
- const {
6
- getCommonPlugins,
7
- getApiSideDefaultBabelConfig,
8
- getWebSideDefaultBabelConfig,
9
- } = require('@cedarjs/babel-config')
10
- const { getConfig, isTypeScriptProject } = require('@cedarjs/project-config')
11
-
12
- const config = getConfig()
13
-
14
- const getProjectBabelOptions = () => {
15
- // We can't nest the web overrides inside the overrides block
16
- // So we just take it out and put it as a separate item
17
- // Ignoring overrides, as I don't think it has any impact on linting
18
- const { overrides: _webOverrides, ...otherWebConfig } =
19
- getWebSideDefaultBabelConfig({
20
- // We have to enable certain presets like `@babel/preset-react` for JavaScript projects
21
- forJavaScriptLinting: !isTypeScriptProject(),
22
- })
23
-
24
- const { overrides: _apiOverrides, ...otherApiConfig } =
25
- getApiSideDefaultBabelConfig()
26
-
27
- return {
28
- plugins: getCommonPlugins(),
29
- overrides: [
30
- {
31
- test: ['./api/', './scripts/'],
32
- ...otherApiConfig,
33
- },
34
- {
35
- test: ['./web/'],
36
- ...otherWebConfig,
37
- },
38
- ],
39
- }
40
- }
41
-
42
- const plugins = []
43
- const rules = {}
44
-
45
- // Add react compiler plugin & rules if enabled
46
- const reactCompilerEnabled =
47
- config.experimental?.reactCompiler?.enabled ?? false
48
- if (reactCompilerEnabled) {
49
- plugins.push('react-compiler')
50
- rules['react-compiler/react-compiler'] = 2
51
- }
52
-
53
- module.exports = {
54
- extends: [
55
- './shared.js',
56
- config.web.a11y && 'plugin:jsx-a11y/recommended',
57
- ].filter(Boolean),
58
- // This is merged with `ignorePatterns` in shared.js
59
- ignorePatterns: ['!.storybook/'],
60
- parserOptions: {
61
- requireConfigFile: false,
62
- babelOptions: getProjectBabelOptions(),
63
- },
64
- plugins,
65
- rules,
66
- overrides: [
67
- {
68
- files: ['web/src/Routes.js', 'web/src/Routes.jsx', 'web/src/Routes.tsx'],
69
- rules: {
70
- 'no-undef': 'off',
71
- 'jsx-a11y/aria-role': [
72
- 2,
73
- {
74
- ignoreNonDOM: true,
75
- },
76
- ],
77
- '@cedarjs/unsupported-route-components': 'error',
78
- },
79
- },
80
- // `api` side
81
- {
82
- files: 'api/src/**',
83
- env: {
84
- node: true,
85
- es6: true,
86
- },
87
- globals: {
88
- gql: 'readonly',
89
- context: 'readonly',
90
- },
91
- },
92
- {
93
- files: ['api/src/services/**/*.ts'],
94
- plugins: ['@cedarjs'],
95
- rules: {
96
- '@cedarjs/service-type-annotations': 'off',
97
- },
98
- },
99
- {
100
- files: ['api/db/seed.js', 'scripts/**'],
101
- env: {
102
- node: true,
103
- commonjs: true,
104
- },
105
- globals: {
106
- Promise: 'readonly',
107
- },
108
- },
109
- // `web` side
110
- {
111
- files: 'web/src/**',
112
- env: {
113
- browser: true,
114
- es6: true,
115
- 'shared-node-browser': true,
116
- },
117
- globals: {
118
- React: 'readonly',
119
- gql: 'readonly',
120
- process: 'readonly',
121
- require: 'readonly',
122
- },
123
- },
124
- // Test, stories, scenarios, and mock files
125
- {
126
- files: [
127
- '*.test.*',
128
- '**/__mocks__/**',
129
- '*.scenarios.*',
130
- '*.stories.*',
131
- '*.mock.*',
132
- ],
133
- globals: {
134
- mockGraphQLQuery: 'readonly',
135
- mockGraphQLMutation: 'readonly',
136
- mockCurrentUser: 'readonly',
137
- scenario: 'readonly',
138
- defineScenario: 'readonly',
139
- },
140
- },
141
- ],
142
- }