@prairielearn/eslint-config 0.0.1 → 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.
- package/.turbo/turbo-build.log +0 -0
- package/README.md +111 -43
- package/dist/configs/base.d.ts +7 -0
- package/dist/configs/base.d.ts.map +1 -0
- package/dist/configs/base.js +121 -0
- package/dist/configs/base.js.map +1 -0
- package/dist/configs/imports.d.ts +6 -0
- package/dist/configs/imports.d.ts.map +1 -0
- package/dist/configs/imports.js +44 -0
- package/dist/configs/imports.js.map +1 -0
- package/dist/configs/jsdoc.d.ts +6 -0
- package/dist/configs/jsdoc.d.ts.map +1 -0
- package/dist/configs/jsdoc.js +70 -0
- package/dist/configs/jsdoc.js.map +1 -0
- package/dist/configs/lodash.d.ts +6 -0
- package/dist/configs/lodash.d.ts.map +1 -0
- package/dist/configs/lodash.js +24 -0
- package/dist/configs/lodash.js.map +1 -0
- package/dist/configs/perfectionist.d.ts +8 -0
- package/dist/configs/perfectionist.d.ts.map +1 -0
- package/dist/configs/perfectionist.js +43 -0
- package/dist/configs/perfectionist.js.map +1 -0
- package/dist/configs/prairielearn.d.ts +13 -0
- package/dist/configs/prairielearn.d.ts.map +1 -0
- package/dist/configs/prairielearn.js +29 -0
- package/dist/configs/prairielearn.js.map +1 -0
- package/dist/configs/react.d.ts +6 -0
- package/dist/configs/react.d.ts.map +1 -0
- package/dist/configs/react.js +63 -0
- package/dist/configs/react.js.map +1 -0
- package/dist/configs/stylistic.d.ts +6 -0
- package/dist/configs/stylistic.d.ts.map +1 -0
- package/dist/configs/stylistic.js +51 -0
- package/dist/configs/stylistic.js.map +1 -0
- package/dist/configs/tanstack.d.ts +6 -0
- package/dist/configs/tanstack.d.ts.map +1 -0
- package/dist/configs/tanstack.js +19 -0
- package/dist/configs/tanstack.js.map +1 -0
- package/dist/configs/typescript.d.ts +11 -0
- package/dist/configs/typescript.d.ts.map +1 -0
- package/dist/configs/typescript.js +106 -0
- package/dist/configs/typescript.js.map +1 -0
- package/dist/configs/unicorn.d.ts +6 -0
- package/dist/configs/unicorn.d.ts.map +1 -0
- package/dist/configs/unicorn.js +74 -0
- package/dist/configs/unicorn.js.map +1 -0
- package/dist/configs/vitest.d.ts +6 -0
- package/dist/configs/vitest.d.ts.map +1 -0
- package/dist/configs/vitest.js +26 -0
- package/dist/configs/vitest.js.map +1 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +112 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -7
- package/src/configs/base.ts +127 -0
- package/src/configs/imports.ts +50 -0
- package/src/configs/jsdoc.ts +72 -0
- package/src/configs/lodash.ts +26 -0
- package/src/configs/perfectionist.ts +48 -0
- package/src/configs/prairielearn.ts +42 -0
- package/src/configs/react.ts +82 -0
- package/src/configs/stylistic.ts +54 -0
- package/src/configs/tanstack.ts +21 -0
- package/src/configs/typescript.ts +108 -0
- package/src/configs/unicorn.ts +84 -0
- package/src/configs/vitest.ts +31 -0
- package/src/index.ts +190 -0
- package/src/types.d.ts +6 -0
- package/tsconfig.json +7 -0
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,45 +1,113 @@
|
|
|
1
1
|
# @prairielearn/eslint-config
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
3
|
+
Shared ESLint configuration for PrairieLearn projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @prairielearn/eslint-config
|
|
9
|
+
# or
|
|
10
|
+
yarn add @prairielearn/eslint-config
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Create an `eslint.config.mjs` file in your project root:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { prairielearn } from '@prairielearn/eslint-config';
|
|
19
|
+
|
|
20
|
+
export default [
|
|
21
|
+
...prairielearn({
|
|
22
|
+
tsconfigRootDir: import.meta.dirname,
|
|
23
|
+
}),
|
|
24
|
+
// Add your project-specific rules here
|
|
25
|
+
];
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Options
|
|
29
|
+
|
|
30
|
+
| Option | Type | Default | Description |
|
|
31
|
+
| --------------------- | ---------- | ----------------------------------------------------- | ------------------------------------------------------- |
|
|
32
|
+
| `tsconfigRootDir` | `string` | _required_ | Root directory for TypeScript project service |
|
|
33
|
+
| `typeAwareFiles` | `string[]` | `['**/*.{ts,tsx}']` | Glob patterns for files to apply type-aware rules to |
|
|
34
|
+
| `allowDefaultProject` | `string[]` | `['*.config.ts', '*.config.mts', 'vitest.config.ts']` | Files to allow in defaultProject for type-aware linting |
|
|
35
|
+
| `prairielearn` | `boolean` | `true` | Enable `@prairielearn/eslint-plugin` rules |
|
|
36
|
+
| `prairieLearnOptions` | `object` | `{}` | Options for `@prairielearn/eslint-plugin` (see below) |
|
|
37
|
+
| `ignores` | `string[]` | `[]` | Additional global ignores |
|
|
38
|
+
| `disable` | `object` | `{}` | Disable specific config modules |
|
|
39
|
+
|
|
40
|
+
### Disabling Config Modules
|
|
41
|
+
|
|
42
|
+
You can disable specific config modules:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
...prairielearn({
|
|
46
|
+
tsconfigRootDir: import.meta.dirname,
|
|
47
|
+
disable: {
|
|
48
|
+
react: true, // Disable React/hooks/accessibility rules
|
|
49
|
+
vitest: true, // Disable Vitest test rules
|
|
50
|
+
perfectionist: true, // Disable sorting rules
|
|
51
|
+
unicorn: true, // Disable Unicorn rules
|
|
52
|
+
jsdoc: true, // Disable JSDoc rules
|
|
53
|
+
tanstack: true, // Disable TanStack Query rules
|
|
54
|
+
lodash: true, // Disable lodash replacement rules
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### PrairieLearn Plugin Options
|
|
60
|
+
|
|
61
|
+
The `prairieLearnOptions` object accepts:
|
|
62
|
+
|
|
63
|
+
| Option | Type | Default | Description |
|
|
64
|
+
| -------------- | ---------- | ------- | ----------------------------------------------- |
|
|
65
|
+
| `allowDbTypes` | `string[]` | `[]` | Type names to allow in the `safe-db-types` rule |
|
|
66
|
+
|
|
67
|
+
Example:
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
...prairielearn({
|
|
71
|
+
tsconfigRootDir: import.meta.dirname,
|
|
72
|
+
prairieLearnOptions: {
|
|
73
|
+
allowDbTypes: ['SprocUsersGetDisplayedRoleSchema'],
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Included Plugins
|
|
79
|
+
|
|
80
|
+
This config includes rules from:
|
|
81
|
+
|
|
82
|
+
- `@typescript-eslint` - TypeScript-specific rules
|
|
83
|
+
- `@eslint-react` - React best practices
|
|
84
|
+
- `react-hooks` - React Hooks rules
|
|
85
|
+
- `jsx-a11y-x` - Accessibility rules
|
|
86
|
+
- `import-x` - Import ordering
|
|
87
|
+
- `perfectionist` - Code sorting
|
|
88
|
+
- `unicorn` - JavaScript best practices
|
|
89
|
+
- `vitest` - Test framework rules
|
|
90
|
+
- `jsdoc` - Documentation rules
|
|
91
|
+
- `@stylistic` - Code style rules
|
|
92
|
+
- `@tanstack/query` - React Query rules
|
|
93
|
+
- `@prairielearn/eslint-plugin` - PrairieLearn-specific rules
|
|
94
|
+
|
|
95
|
+
## Advanced Usage
|
|
96
|
+
|
|
97
|
+
For advanced customization, you can import individual config functions. Note that type-aware linting requires the `tsconfigRootDir` option which is only configured by the main `prairielearn()` function:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import {
|
|
101
|
+
baseConfig,
|
|
102
|
+
typescriptConfig,
|
|
103
|
+
reactConfig,
|
|
104
|
+
importsConfig,
|
|
105
|
+
// ... etc
|
|
106
|
+
} from '@prairielearn/eslint-config';
|
|
107
|
+
|
|
108
|
+
export default [
|
|
109
|
+
...baseConfig(),
|
|
110
|
+
...typescriptConfig(),
|
|
111
|
+
// Mix and match as needed
|
|
112
|
+
];
|
|
113
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Base JavaScript/TypeScript configuration.
|
|
4
|
+
* Core rules that apply to all JS/TS files.
|
|
5
|
+
*/
|
|
6
|
+
export declare function baseConfig(): TSESLint.FlatConfig.ConfigArray;
|
|
7
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/configs/base.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzD;;;GAGG;AACH,wBAAgB,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAqH5D","sourcesContent":["import js from '@eslint/js';\nimport type { TSESLint } from '@typescript-eslint/utils';\nimport noFloatingPromise from 'eslint-plugin-no-floating-promise';\nimport globals from 'globals';\n\n/**\n * Base JavaScript/TypeScript configuration.\n * Core rules that apply to all JS/TS files.\n */\nexport function baseConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n languageOptions: {\n globals: { ...globals.node },\n },\n\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n },\n\n plugins: {\n 'no-floating-promise': noFloatingPromise,\n },\n\n rules: {\n ...js.configs.all.rules,\n 'array-callback-return': 'off',\n 'arrow-body-style': 'off',\n camelcase: 'off',\n 'capitalized-comments': 'off',\n 'class-methods-use-this': 'off',\n complexity: 'off',\n 'consistent-return': 'off',\n 'consistent-this': 'off',\n curly: ['error', 'multi-line', 'consistent'],\n 'default-case': 'off',\n 'dot-notation': 'off',\n eqeqeq: ['error', 'smart'],\n 'func-names': 'off',\n 'func-style': 'off',\n 'guard-for-in': 'off',\n 'handle-callback-err': 'error',\n 'id-length': 'off',\n 'init-declarations': 'off',\n 'logical-assignment-operators': 'off',\n 'max-classes-per-file': 'off',\n 'max-depth': 'off',\n 'max-lines': 'off',\n 'max-lines-per-function': 'off',\n 'max-params': 'off',\n 'max-statements': 'off',\n 'new-cap': 'off',\n 'no-await-in-loop': 'off',\n 'no-bitwise': 'off',\n 'no-console': ['error', { allow: ['warn', 'error', 'table', 'trace'] }],\n 'no-continue': 'off',\n 'no-duplicate-imports': 'error',\n 'no-else-return': 'off',\n 'no-empty-function': 'off',\n 'no-eq-null': 'off',\n 'no-implicit-coercion': 'off',\n 'no-inline-comments': 'off',\n 'no-invalid-this': 'off',\n 'no-lonely-if': 'off',\n 'no-loop-func': 'off',\n 'no-magic-numbers': 'off',\n 'no-negated-condition': 'off',\n 'no-nested-ternary': 'off',\n 'no-new': 'off',\n 'no-param-reassign': 'off',\n 'no-plusplus': 'off',\n 'no-promise-executor-return': 'off',\n 'no-redeclare': 'off',\n 'no-restricted-globals': [\n 'error',\n // These are not available in ES modules.\n '__filename',\n '__dirname',\n ],\n 'no-shadow': 'off',\n 'no-template-curly-in-string': 'error',\n 'no-ternary': 'off',\n 'no-undef': 'off',\n 'no-undef-init': 'off',\n 'no-undefined': 'off',\n 'no-underscore-dangle': 'off',\n 'no-unmodified-loop-condition': 'off',\n 'no-unneeded-ternary': 'off',\n 'no-unused-vars': 'off',\n 'no-use-before-define': 'off',\n 'no-useless-assignment': 'off',\n 'no-useless-concat': 'off',\n 'no-useless-constructor': 'off',\n 'no-useless-return': 'off',\n 'no-void': 'off', // https://typescript-eslint.io/rules/no-floating-promises/#ignorevoid\n 'no-warning-comments': 'off',\n 'object-shorthand': 'error',\n 'one-var': ['off', 'never'],\n 'prefer-arrow-callback': 'off',\n 'prefer-const': ['error', { destructuring: 'all' }],\n 'prefer-destructuring': 'off',\n 'prefer-named-capture-group': 'off',\n 'prefer-object-has-own': 'off',\n 'prefer-template': 'off',\n radix: ['error', 'as-needed'],\n 'require-atomic-updates': 'off',\n 'require-await': 'off',\n 'require-unicode-regexp': 'off',\n 'sort-vars': 'off',\n 'sort-keys': 'off',\n\n // Floating promise detection\n 'no-floating-promise/no-floating-promise': 'error',\n\n // Sort imports within a single import statement\n 'sort-imports': [\n 'error',\n {\n ignoreDeclarationSort: true,\n ignoreMemberSort: false,\n memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],\n },\n ],\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import noFloatingPromise from 'eslint-plugin-no-floating-promise';
|
|
3
|
+
import globals from 'globals';
|
|
4
|
+
/**
|
|
5
|
+
* Base JavaScript/TypeScript configuration.
|
|
6
|
+
* Core rules that apply to all JS/TS files.
|
|
7
|
+
*/
|
|
8
|
+
export function baseConfig() {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
languageOptions: {
|
|
12
|
+
globals: { ...globals.node },
|
|
13
|
+
},
|
|
14
|
+
linterOptions: {
|
|
15
|
+
reportUnusedDisableDirectives: 'error',
|
|
16
|
+
},
|
|
17
|
+
plugins: {
|
|
18
|
+
'no-floating-promise': noFloatingPromise,
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
...js.configs.all.rules,
|
|
22
|
+
'array-callback-return': 'off',
|
|
23
|
+
'arrow-body-style': 'off',
|
|
24
|
+
camelcase: 'off',
|
|
25
|
+
'capitalized-comments': 'off',
|
|
26
|
+
'class-methods-use-this': 'off',
|
|
27
|
+
complexity: 'off',
|
|
28
|
+
'consistent-return': 'off',
|
|
29
|
+
'consistent-this': 'off',
|
|
30
|
+
curly: ['error', 'multi-line', 'consistent'],
|
|
31
|
+
'default-case': 'off',
|
|
32
|
+
'dot-notation': 'off',
|
|
33
|
+
eqeqeq: ['error', 'smart'],
|
|
34
|
+
'func-names': 'off',
|
|
35
|
+
'func-style': 'off',
|
|
36
|
+
'guard-for-in': 'off',
|
|
37
|
+
'handle-callback-err': 'error',
|
|
38
|
+
'id-length': 'off',
|
|
39
|
+
'init-declarations': 'off',
|
|
40
|
+
'logical-assignment-operators': 'off',
|
|
41
|
+
'max-classes-per-file': 'off',
|
|
42
|
+
'max-depth': 'off',
|
|
43
|
+
'max-lines': 'off',
|
|
44
|
+
'max-lines-per-function': 'off',
|
|
45
|
+
'max-params': 'off',
|
|
46
|
+
'max-statements': 'off',
|
|
47
|
+
'new-cap': 'off',
|
|
48
|
+
'no-await-in-loop': 'off',
|
|
49
|
+
'no-bitwise': 'off',
|
|
50
|
+
'no-console': ['error', { allow: ['warn', 'error', 'table', 'trace'] }],
|
|
51
|
+
'no-continue': 'off',
|
|
52
|
+
'no-duplicate-imports': 'error',
|
|
53
|
+
'no-else-return': 'off',
|
|
54
|
+
'no-empty-function': 'off',
|
|
55
|
+
'no-eq-null': 'off',
|
|
56
|
+
'no-implicit-coercion': 'off',
|
|
57
|
+
'no-inline-comments': 'off',
|
|
58
|
+
'no-invalid-this': 'off',
|
|
59
|
+
'no-lonely-if': 'off',
|
|
60
|
+
'no-loop-func': 'off',
|
|
61
|
+
'no-magic-numbers': 'off',
|
|
62
|
+
'no-negated-condition': 'off',
|
|
63
|
+
'no-nested-ternary': 'off',
|
|
64
|
+
'no-new': 'off',
|
|
65
|
+
'no-param-reassign': 'off',
|
|
66
|
+
'no-plusplus': 'off',
|
|
67
|
+
'no-promise-executor-return': 'off',
|
|
68
|
+
'no-redeclare': 'off',
|
|
69
|
+
'no-restricted-globals': [
|
|
70
|
+
'error',
|
|
71
|
+
// These are not available in ES modules.
|
|
72
|
+
'__filename',
|
|
73
|
+
'__dirname',
|
|
74
|
+
],
|
|
75
|
+
'no-shadow': 'off',
|
|
76
|
+
'no-template-curly-in-string': 'error',
|
|
77
|
+
'no-ternary': 'off',
|
|
78
|
+
'no-undef': 'off',
|
|
79
|
+
'no-undef-init': 'off',
|
|
80
|
+
'no-undefined': 'off',
|
|
81
|
+
'no-underscore-dangle': 'off',
|
|
82
|
+
'no-unmodified-loop-condition': 'off',
|
|
83
|
+
'no-unneeded-ternary': 'off',
|
|
84
|
+
'no-unused-vars': 'off',
|
|
85
|
+
'no-use-before-define': 'off',
|
|
86
|
+
'no-useless-assignment': 'off',
|
|
87
|
+
'no-useless-concat': 'off',
|
|
88
|
+
'no-useless-constructor': 'off',
|
|
89
|
+
'no-useless-return': 'off',
|
|
90
|
+
'no-void': 'off', // https://typescript-eslint.io/rules/no-floating-promises/#ignorevoid
|
|
91
|
+
'no-warning-comments': 'off',
|
|
92
|
+
'object-shorthand': 'error',
|
|
93
|
+
'one-var': ['off', 'never'],
|
|
94
|
+
'prefer-arrow-callback': 'off',
|
|
95
|
+
'prefer-const': ['error', { destructuring: 'all' }],
|
|
96
|
+
'prefer-destructuring': 'off',
|
|
97
|
+
'prefer-named-capture-group': 'off',
|
|
98
|
+
'prefer-object-has-own': 'off',
|
|
99
|
+
'prefer-template': 'off',
|
|
100
|
+
radix: ['error', 'as-needed'],
|
|
101
|
+
'require-atomic-updates': 'off',
|
|
102
|
+
'require-await': 'off',
|
|
103
|
+
'require-unicode-regexp': 'off',
|
|
104
|
+
'sort-vars': 'off',
|
|
105
|
+
'sort-keys': 'off',
|
|
106
|
+
// Floating promise detection
|
|
107
|
+
'no-floating-promise/no-floating-promise': 'error',
|
|
108
|
+
// Sort imports within a single import statement
|
|
109
|
+
'sort-imports': [
|
|
110
|
+
'error',
|
|
111
|
+
{
|
|
112
|
+
ignoreDeclarationSort: true,
|
|
113
|
+
ignoreMemberSort: false,
|
|
114
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/configs/base.ts"],"names":[],"mappings":"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","sourcesContent":["import js from '@eslint/js';\nimport type { TSESLint } from '@typescript-eslint/utils';\nimport noFloatingPromise from 'eslint-plugin-no-floating-promise';\nimport globals from 'globals';\n\n/**\n * Base JavaScript/TypeScript configuration.\n * Core rules that apply to all JS/TS files.\n */\nexport function baseConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n languageOptions: {\n globals: { ...globals.node },\n },\n\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n },\n\n plugins: {\n 'no-floating-promise': noFloatingPromise,\n },\n\n rules: {\n ...js.configs.all.rules,\n 'array-callback-return': 'off',\n 'arrow-body-style': 'off',\n camelcase: 'off',\n 'capitalized-comments': 'off',\n 'class-methods-use-this': 'off',\n complexity: 'off',\n 'consistent-return': 'off',\n 'consistent-this': 'off',\n curly: ['error', 'multi-line', 'consistent'],\n 'default-case': 'off',\n 'dot-notation': 'off',\n eqeqeq: ['error', 'smart'],\n 'func-names': 'off',\n 'func-style': 'off',\n 'guard-for-in': 'off',\n 'handle-callback-err': 'error',\n 'id-length': 'off',\n 'init-declarations': 'off',\n 'logical-assignment-operators': 'off',\n 'max-classes-per-file': 'off',\n 'max-depth': 'off',\n 'max-lines': 'off',\n 'max-lines-per-function': 'off',\n 'max-params': 'off',\n 'max-statements': 'off',\n 'new-cap': 'off',\n 'no-await-in-loop': 'off',\n 'no-bitwise': 'off',\n 'no-console': ['error', { allow: ['warn', 'error', 'table', 'trace'] }],\n 'no-continue': 'off',\n 'no-duplicate-imports': 'error',\n 'no-else-return': 'off',\n 'no-empty-function': 'off',\n 'no-eq-null': 'off',\n 'no-implicit-coercion': 'off',\n 'no-inline-comments': 'off',\n 'no-invalid-this': 'off',\n 'no-lonely-if': 'off',\n 'no-loop-func': 'off',\n 'no-magic-numbers': 'off',\n 'no-negated-condition': 'off',\n 'no-nested-ternary': 'off',\n 'no-new': 'off',\n 'no-param-reassign': 'off',\n 'no-plusplus': 'off',\n 'no-promise-executor-return': 'off',\n 'no-redeclare': 'off',\n 'no-restricted-globals': [\n 'error',\n // These are not available in ES modules.\n '__filename',\n '__dirname',\n ],\n 'no-shadow': 'off',\n 'no-template-curly-in-string': 'error',\n 'no-ternary': 'off',\n 'no-undef': 'off',\n 'no-undef-init': 'off',\n 'no-undefined': 'off',\n 'no-underscore-dangle': 'off',\n 'no-unmodified-loop-condition': 'off',\n 'no-unneeded-ternary': 'off',\n 'no-unused-vars': 'off',\n 'no-use-before-define': 'off',\n 'no-useless-assignment': 'off',\n 'no-useless-concat': 'off',\n 'no-useless-constructor': 'off',\n 'no-useless-return': 'off',\n 'no-void': 'off', // https://typescript-eslint.io/rules/no-floating-promises/#ignorevoid\n 'no-warning-comments': 'off',\n 'object-shorthand': 'error',\n 'one-var': ['off', 'never'],\n 'prefer-arrow-callback': 'off',\n 'prefer-const': ['error', { destructuring: 'all' }],\n 'prefer-destructuring': 'off',\n 'prefer-named-capture-group': 'off',\n 'prefer-object-has-own': 'off',\n 'prefer-template': 'off',\n radix: ['error', 'as-needed'],\n 'require-atomic-updates': 'off',\n 'require-await': 'off',\n 'require-unicode-regexp': 'off',\n 'sort-vars': 'off',\n 'sort-keys': 'off',\n\n // Floating promise detection\n 'no-floating-promise/no-floating-promise': 'error',\n\n // Sort imports within a single import statement\n 'sort-imports': [\n 'error',\n {\n ignoreDeclarationSort: true,\n ignoreMemberSort: false,\n memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],\n },\n ],\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/configs/imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;GAEG;AACH,wBAAgB,aAAa,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CA2C/D","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport importX from 'eslint-plugin-import-x';\n\n/**\n * Import ordering and resolution rules.\n */\nexport function importsConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n 'import-x': importX,\n },\n\n rules: {\n // Enforce alphabetical order of import specifiers within each import group.\n // The import-x/order rule handles the overall sorting of the import groups.\n 'import-x/order': [\n 'error',\n {\n alphabetize: {\n order: 'asc',\n },\n\n 'newlines-between': 'always',\n\n pathGroups: [\n {\n group: 'external',\n pattern: '@prairielearn/**',\n position: 'after',\n },\n ],\n\n pathGroupsExcludedImportTypes: ['builtin'],\n },\n ],\n },\n\n settings: {\n 'import-x/parsers': {\n '@typescript-eslint/parser': ['.ts', '.js'],\n },\n 'import-x/resolver': {\n node: true,\n typescript: true,\n },\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import importX from 'eslint-plugin-import-x';
|
|
2
|
+
/**
|
|
3
|
+
* Import ordering and resolution rules.
|
|
4
|
+
*/
|
|
5
|
+
export function importsConfig() {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
plugins: {
|
|
9
|
+
'import-x': importX,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
// Enforce alphabetical order of import specifiers within each import group.
|
|
13
|
+
// The import-x/order rule handles the overall sorting of the import groups.
|
|
14
|
+
'import-x/order': [
|
|
15
|
+
'error',
|
|
16
|
+
{
|
|
17
|
+
alphabetize: {
|
|
18
|
+
order: 'asc',
|
|
19
|
+
},
|
|
20
|
+
'newlines-between': 'always',
|
|
21
|
+
pathGroups: [
|
|
22
|
+
{
|
|
23
|
+
group: 'external',
|
|
24
|
+
pattern: '@prairielearn/**',
|
|
25
|
+
position: 'after',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
pathGroupsExcludedImportTypes: ['builtin'],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
settings: {
|
|
33
|
+
'import-x/parsers': {
|
|
34
|
+
'@typescript-eslint/parser': ['.ts', '.js'],
|
|
35
|
+
},
|
|
36
|
+
'import-x/resolver': {
|
|
37
|
+
node: true,
|
|
38
|
+
typescript: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/configs/imports.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,aAAa,GAAoC;IAC/D,OAAO;QACL;YACE,OAAO,EAAE;gBACP,UAAU,EAAE,OAAO;aACpB;YAED,KAAK,EAAE;gBACL,4EAA4E;gBAC5E,4EAA4E;gBAC5E,gBAAgB,EAAE;oBAChB,OAAO;oBACP;wBACE,WAAW,EAAE;4BACX,KAAK,EAAE,KAAK;yBACb;wBAED,kBAAkB,EAAE,QAAQ;wBAE5B,UAAU,EAAE;4BACV;gCACE,KAAK,EAAE,UAAU;gCACjB,OAAO,EAAE,kBAAkB;gCAC3B,QAAQ,EAAE,OAAO;6BAClB;yBACF;wBAED,6BAA6B,EAAE,CAAC,SAAS,CAAC;qBAC3C;iBACF;aACF;YAED,QAAQ,EAAE;gBACR,kBAAkB,EAAE;oBAClB,2BAA2B,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;iBAC5C;gBACD,mBAAmB,EAAE;oBACnB,IAAI,EAAE,IAAI;oBACV,UAAU,EAAE,IAAI;iBACjB;aACF;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport importX from 'eslint-plugin-import-x';\n\n/**\n * Import ordering and resolution rules.\n */\nexport function importsConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n 'import-x': importX,\n },\n\n rules: {\n // Enforce alphabetical order of import specifiers within each import group.\n // The import-x/order rule handles the overall sorting of the import groups.\n 'import-x/order': [\n 'error',\n {\n alphabetize: {\n order: 'asc',\n },\n\n 'newlines-between': 'always',\n\n pathGroups: [\n {\n group: 'external',\n pattern: '@prairielearn/**',\n position: 'after',\n },\n ],\n\n pathGroupsExcludedImportTypes: ['builtin'],\n },\n ],\n },\n\n settings: {\n 'import-x/parsers': {\n '@typescript-eslint/parser': ['.ts', '.js'],\n },\n 'import-x/resolver': {\n node: true,\n typescript: true,\n },\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsdoc.d.ts","sourceRoot":"","sources":["../../src/configs/jsdoc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAiE7D","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport jsdoc from 'eslint-plugin-jsdoc';\n\n/**\n * JSDoc documentation rules.\n */\nexport function jsdocConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n jsdoc,\n },\n\n settings: {\n jsdoc: {\n contexts: [\n // We don't want to require documentation of a 'locals' (res.locals) variable\n // AST Parser: https://github.com/es-joy/jsdoccomment\n {\n comment: 'JsdocBlock:not(:has(JsdocTag[tag=\"param\"][name=\"locals\"]))',\n context: 'FunctionDeclaration',\n },\n {\n comment: 'JsdocBlock:not(:has(JsdocTag[tag=\"param\"][name=\"locals\"]))',\n context: 'FunctionExpression',\n },\n 'ArrowFunctionExpression',\n 'TSDeclareFunction',\n ],\n exemptDestructuredRootsFromChecks: true,\n },\n },\n },\n // TypeScript files\n {\n files: ['**/*.{ts,tsx}'],\n rules: {\n ...jsdoc.configs['flat/recommended-typescript-error'].rules,\n 'jsdoc/check-line-alignment': 'error',\n 'jsdoc/check-tag-names': 'error',\n 'jsdoc/convert-to-jsdoc-comments': [\n 'error',\n {\n allowedPrefixes: ['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-', 'global'],\n contexts: ['FunctionDeclaration', 'TSDeclareFunction'],\n contextsBeforeAndAfter: ['TSPropertySignature'],\n enforceJsdocLineStyle: 'single',\n },\n ],\n 'jsdoc/require-asterisk-prefix': 'error',\n 'jsdoc/require-jsdoc': 'off',\n 'jsdoc/require-param': 'off',\n 'jsdoc/require-returns': 'off',\n 'jsdoc/tag-lines': 'off',\n },\n },\n // JavaScript files\n {\n files: ['**/*.js'],\n rules: {\n ...jsdoc.configs['flat/recommended-typescript-flavor-error'].rules,\n 'jsdoc/check-line-alignment': 'error',\n 'jsdoc/require-asterisk-prefix': 'error',\n 'jsdoc/require-jsdoc': 'off',\n 'jsdoc/require-param': 'off',\n 'jsdoc/require-param-description': 'off',\n 'jsdoc/require-returns': 'off',\n 'jsdoc/tag-lines': 'off',\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import jsdoc from 'eslint-plugin-jsdoc';
|
|
2
|
+
/**
|
|
3
|
+
* JSDoc documentation rules.
|
|
4
|
+
*/
|
|
5
|
+
export function jsdocConfig() {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
plugins: {
|
|
9
|
+
jsdoc,
|
|
10
|
+
},
|
|
11
|
+
settings: {
|
|
12
|
+
jsdoc: {
|
|
13
|
+
contexts: [
|
|
14
|
+
// We don't want to require documentation of a 'locals' (res.locals) variable
|
|
15
|
+
// AST Parser: https://github.com/es-joy/jsdoccomment
|
|
16
|
+
{
|
|
17
|
+
comment: 'JsdocBlock:not(:has(JsdocTag[tag="param"][name="locals"]))',
|
|
18
|
+
context: 'FunctionDeclaration',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
comment: 'JsdocBlock:not(:has(JsdocTag[tag="param"][name="locals"]))',
|
|
22
|
+
context: 'FunctionExpression',
|
|
23
|
+
},
|
|
24
|
+
'ArrowFunctionExpression',
|
|
25
|
+
'TSDeclareFunction',
|
|
26
|
+
],
|
|
27
|
+
exemptDestructuredRootsFromChecks: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
// TypeScript files
|
|
32
|
+
{
|
|
33
|
+
files: ['**/*.{ts,tsx}'],
|
|
34
|
+
rules: {
|
|
35
|
+
...jsdoc.configs['flat/recommended-typescript-error'].rules,
|
|
36
|
+
'jsdoc/check-line-alignment': 'error',
|
|
37
|
+
'jsdoc/check-tag-names': 'error',
|
|
38
|
+
'jsdoc/convert-to-jsdoc-comments': [
|
|
39
|
+
'error',
|
|
40
|
+
{
|
|
41
|
+
allowedPrefixes: ['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-', 'global'],
|
|
42
|
+
contexts: ['FunctionDeclaration', 'TSDeclareFunction'],
|
|
43
|
+
contextsBeforeAndAfter: ['TSPropertySignature'],
|
|
44
|
+
enforceJsdocLineStyle: 'single',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
'jsdoc/require-asterisk-prefix': 'error',
|
|
48
|
+
'jsdoc/require-jsdoc': 'off',
|
|
49
|
+
'jsdoc/require-param': 'off',
|
|
50
|
+
'jsdoc/require-returns': 'off',
|
|
51
|
+
'jsdoc/tag-lines': 'off',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
// JavaScript files
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.js'],
|
|
57
|
+
rules: {
|
|
58
|
+
...jsdoc.configs['flat/recommended-typescript-flavor-error'].rules,
|
|
59
|
+
'jsdoc/check-line-alignment': 'error',
|
|
60
|
+
'jsdoc/require-asterisk-prefix': 'error',
|
|
61
|
+
'jsdoc/require-jsdoc': 'off',
|
|
62
|
+
'jsdoc/require-param': 'off',
|
|
63
|
+
'jsdoc/require-param-description': 'off',
|
|
64
|
+
'jsdoc/require-returns': 'off',
|
|
65
|
+
'jsdoc/tag-lines': 'off',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=jsdoc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsdoc.js","sourceRoot":"","sources":["../../src/configs/jsdoc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,qBAAqB,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,WAAW,GAAoC;IAC7D,OAAO;QACL;YACE,OAAO,EAAE;gBACP,KAAK;aACN;YAED,QAAQ,EAAE;gBACR,KAAK,EAAE;oBACL,QAAQ,EAAE;wBACR,6EAA6E;wBAC7E,qDAAqD;wBACrD;4BACE,OAAO,EAAE,4DAA4D;4BACrE,OAAO,EAAE,qBAAqB;yBAC/B;wBACD;4BACE,OAAO,EAAE,4DAA4D;4BACrE,OAAO,EAAE,oBAAoB;yBAC9B;wBACD,yBAAyB;wBACzB,mBAAmB;qBACpB;oBACD,iCAAiC,EAAE,IAAI;iBACxC;aACF;SACF;QACD,mBAAmB;QACnB;YACE,KAAK,EAAE,CAAC,eAAe,CAAC;YACxB,KAAK,EAAE;gBACL,GAAG,KAAK,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC,KAAK;gBAC3D,4BAA4B,EAAE,OAAO;gBACrC,uBAAuB,EAAE,OAAO;gBAChC,iCAAiC,EAAE;oBACjC,OAAO;oBACP;wBACE,eAAe,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC;wBACrF,QAAQ,EAAE,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;wBACtD,sBAAsB,EAAE,CAAC,qBAAqB,CAAC;wBAC/C,qBAAqB,EAAE,QAAQ;qBAChC;iBACF;gBACD,+BAA+B,EAAE,OAAO;gBACxC,qBAAqB,EAAE,KAAK;gBAC5B,qBAAqB,EAAE,KAAK;gBAC5B,uBAAuB,EAAE,KAAK;gBAC9B,iBAAiB,EAAE,KAAK;aACzB;SACF;QACD,mBAAmB;QACnB;YACE,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,KAAK,EAAE;gBACL,GAAG,KAAK,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC,KAAK;gBAClE,4BAA4B,EAAE,OAAO;gBACrC,+BAA+B,EAAE,OAAO;gBACxC,qBAAqB,EAAE,KAAK;gBAC5B,qBAAqB,EAAE,KAAK;gBAC5B,iCAAiC,EAAE,KAAK;gBACxC,uBAAuB,EAAE,KAAK;gBAC9B,iBAAiB,EAAE,KAAK;aACzB;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport jsdoc from 'eslint-plugin-jsdoc';\n\n/**\n * JSDoc documentation rules.\n */\nexport function jsdocConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n jsdoc,\n },\n\n settings: {\n jsdoc: {\n contexts: [\n // We don't want to require documentation of a 'locals' (res.locals) variable\n // AST Parser: https://github.com/es-joy/jsdoccomment\n {\n comment: 'JsdocBlock:not(:has(JsdocTag[tag=\"param\"][name=\"locals\"]))',\n context: 'FunctionDeclaration',\n },\n {\n comment: 'JsdocBlock:not(:has(JsdocTag[tag=\"param\"][name=\"locals\"]))',\n context: 'FunctionExpression',\n },\n 'ArrowFunctionExpression',\n 'TSDeclareFunction',\n ],\n exemptDestructuredRootsFromChecks: true,\n },\n },\n },\n // TypeScript files\n {\n files: ['**/*.{ts,tsx}'],\n rules: {\n ...jsdoc.configs['flat/recommended-typescript-error'].rules,\n 'jsdoc/check-line-alignment': 'error',\n 'jsdoc/check-tag-names': 'error',\n 'jsdoc/convert-to-jsdoc-comments': [\n 'error',\n {\n allowedPrefixes: ['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-', 'global'],\n contexts: ['FunctionDeclaration', 'TSDeclareFunction'],\n contextsBeforeAndAfter: ['TSPropertySignature'],\n enforceJsdocLineStyle: 'single',\n },\n ],\n 'jsdoc/require-asterisk-prefix': 'error',\n 'jsdoc/require-jsdoc': 'off',\n 'jsdoc/require-param': 'off',\n 'jsdoc/require-returns': 'off',\n 'jsdoc/tag-lines': 'off',\n },\n },\n // JavaScript files\n {\n files: ['**/*.js'],\n rules: {\n ...jsdoc.configs['flat/recommended-typescript-flavor-error'].rules,\n 'jsdoc/check-line-alignment': 'error',\n 'jsdoc/require-asterisk-prefix': 'error',\n 'jsdoc/require-jsdoc': 'off',\n 'jsdoc/require-param': 'off',\n 'jsdoc/require-param-description': 'off',\n 'jsdoc/require-returns': 'off',\n 'jsdoc/tag-lines': 'off',\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lodash.d.ts","sourceRoot":"","sources":["../../src/configs/lodash.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAKzD;;GAEG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAgB9D","sourcesContent":["import { FlatCompat } from '@eslint/eslintrc';\nimport type { TSESLint } from '@typescript-eslint/utils';\nimport youDontNeedLodashUnderscore from 'eslint-plugin-you-dont-need-lodash-underscore';\n\nconst compat = new FlatCompat();\n\n/**\n * Lodash/underscore replacement rules.\n */\nexport function lodashConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n 'you-dont-need-lodash-underscore': youDontNeedLodashUnderscore,\n },\n },\n // Use FlatCompat to extend the legacy config\n ...compat.extends('plugin:you-dont-need-lodash-underscore/all'),\n {\n rules: {\n // The _.omit function is still useful in some contexts.\n 'you-dont-need-lodash-underscore/omit': 'off',\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
2
|
+
import youDontNeedLodashUnderscore from 'eslint-plugin-you-dont-need-lodash-underscore';
|
|
3
|
+
const compat = new FlatCompat();
|
|
4
|
+
/**
|
|
5
|
+
* Lodash/underscore replacement rules.
|
|
6
|
+
*/
|
|
7
|
+
export function lodashConfig() {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
plugins: {
|
|
11
|
+
'you-dont-need-lodash-underscore': youDontNeedLodashUnderscore,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
// Use FlatCompat to extend the legacy config
|
|
15
|
+
...compat.extends('plugin:you-dont-need-lodash-underscore/all'),
|
|
16
|
+
{
|
|
17
|
+
rules: {
|
|
18
|
+
// The _.omit function is still useful in some contexts.
|
|
19
|
+
'you-dont-need-lodash-underscore/omit': 'off',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=lodash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lodash.js","sourceRoot":"","sources":["../../src/configs/lodash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,2BAA2B,MAAM,+CAA+C,CAAC;AAExF,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,YAAY,GAAoC;IAC9D,OAAO;QACL;YACE,OAAO,EAAE;gBACP,iCAAiC,EAAE,2BAA2B;aAC/D;SACF;QACD,6CAA6C;QAC7C,GAAG,MAAM,CAAC,OAAO,CAAC,4CAA4C,CAAC;QAC/D;YACE,KAAK,EAAE;gBACL,wDAAwD;gBACxD,sCAAsC,EAAE,KAAK;aAC9C;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import { FlatCompat } from '@eslint/eslintrc';\nimport type { TSESLint } from '@typescript-eslint/utils';\nimport youDontNeedLodashUnderscore from 'eslint-plugin-you-dont-need-lodash-underscore';\n\nconst compat = new FlatCompat();\n\n/**\n * Lodash/underscore replacement rules.\n */\nexport function lodashConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n 'you-dont-need-lodash-underscore': youDontNeedLodashUnderscore,\n },\n },\n // Use FlatCompat to extend the legacy config\n ...compat.extends('plugin:you-dont-need-lodash-underscore/all'),\n {\n rules: {\n // The _.omit function is still useful in some contexts.\n 'you-dont-need-lodash-underscore/omit': 'off',\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Perfectionist sorting rules.
|
|
4
|
+
* Most rules are off by default but pre-configured for convenient inline enabling.
|
|
5
|
+
* `sort-jsx-props` is enabled by default with callback grouping.
|
|
6
|
+
*/
|
|
7
|
+
export declare function perfectionistConfig(): TSESLint.FlatConfig.ConfigArray;
|
|
8
|
+
//# sourceMappingURL=perfectionist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perfectionist.d.ts","sourceRoot":"","sources":["../../src/configs/perfectionist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAuCrE","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport perfectionist from 'eslint-plugin-perfectionist';\n\n/**\n * Perfectionist sorting rules.\n * Most rules are off by default but pre-configured for convenient inline enabling.\n * `sort-jsx-props` is enabled by default with callback grouping.\n */\nexport function perfectionistConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n perfectionist,\n },\n\n rules: {\n // Configure all perfectionist rules to be off by default but with options preset\n ...Object.fromEntries(\n Object.keys(perfectionist.rules ?? {}).map((ruleName) => [\n 'perfectionist/' + ruleName,\n [\n // Configure the options for every rule, to make inline usage more convenient.\n 'off',\n // These rules don't have a comment partition\n ['sort-heritage-clauses', 'sort-jsx-props', 'sort-switch-case'].includes(ruleName)\n ? { type: 'natural' }\n : { partitionByComment: true, type: 'natural' },\n ],\n ]),\n ),\n\n // Enable sort-jsx-props with callback grouping\n 'perfectionist/sort-jsx-props': [\n 'error',\n {\n customGroups: [\n { elementNamePattern: '^on[A-Z]', groupName: 'callback' },\n { elementNamePattern: '^(key|ref)$', groupName: 'reserved' },\n ],\n groups: ['reserved', 'unknown', 'shorthand-prop', 'callback'],\n ignoreCase: true,\n type: 'unsorted',\n },\n ],\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import perfectionist from 'eslint-plugin-perfectionist';
|
|
2
|
+
/**
|
|
3
|
+
* Perfectionist sorting rules.
|
|
4
|
+
* Most rules are off by default but pre-configured for convenient inline enabling.
|
|
5
|
+
* `sort-jsx-props` is enabled by default with callback grouping.
|
|
6
|
+
*/
|
|
7
|
+
export function perfectionistConfig() {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
plugins: {
|
|
11
|
+
perfectionist,
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
// Configure all perfectionist rules to be off by default but with options preset
|
|
15
|
+
...Object.fromEntries(Object.keys(perfectionist.rules ?? {}).map((ruleName) => [
|
|
16
|
+
'perfectionist/' + ruleName,
|
|
17
|
+
[
|
|
18
|
+
// Configure the options for every rule, to make inline usage more convenient.
|
|
19
|
+
'off',
|
|
20
|
+
// These rules don't have a comment partition
|
|
21
|
+
['sort-heritage-clauses', 'sort-jsx-props', 'sort-switch-case'].includes(ruleName)
|
|
22
|
+
? { type: 'natural' }
|
|
23
|
+
: { partitionByComment: true, type: 'natural' },
|
|
24
|
+
],
|
|
25
|
+
])),
|
|
26
|
+
// Enable sort-jsx-props with callback grouping
|
|
27
|
+
'perfectionist/sort-jsx-props': [
|
|
28
|
+
'error',
|
|
29
|
+
{
|
|
30
|
+
customGroups: [
|
|
31
|
+
{ elementNamePattern: '^on[A-Z]', groupName: 'callback' },
|
|
32
|
+
{ elementNamePattern: '^(key|ref)$', groupName: 'reserved' },
|
|
33
|
+
],
|
|
34
|
+
groups: ['reserved', 'unknown', 'shorthand-prop', 'callback'],
|
|
35
|
+
ignoreCase: true,
|
|
36
|
+
type: 'unsorted',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=perfectionist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perfectionist.js","sourceRoot":"","sources":["../../src/configs/perfectionist.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,GAAoC;IACrE,OAAO;QACL;YACE,OAAO,EAAE;gBACP,aAAa;aACd;YAED,KAAK,EAAE;gBACL,iFAAiF;gBACjF,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACvD,gBAAgB,GAAG,QAAQ;oBAC3B;wBACE,8EAA8E;wBAC9E,KAAK;wBACL,6CAA6C;wBAC7C,CAAC,uBAAuB,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;4BAChF,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE;4BACrB,CAAC,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;qBAClD;iBACF,CAAC,CACH;gBAED,+CAA+C;gBAC/C,8BAA8B,EAAE;oBAC9B,OAAO;oBACP;wBACE,YAAY,EAAE;4BACZ,EAAE,kBAAkB,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE;4BACzD,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE;yBAC7D;wBACD,MAAM,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,CAAC;wBAC7D,UAAU,EAAE,IAAI;wBAChB,IAAI,EAAE,UAAU;qBACjB;iBACF;aACF;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport perfectionist from 'eslint-plugin-perfectionist';\n\n/**\n * Perfectionist sorting rules.\n * Most rules are off by default but pre-configured for convenient inline enabling.\n * `sort-jsx-props` is enabled by default with callback grouping.\n */\nexport function perfectionistConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n perfectionist,\n },\n\n rules: {\n // Configure all perfectionist rules to be off by default but with options preset\n ...Object.fromEntries(\n Object.keys(perfectionist.rules ?? {}).map((ruleName) => [\n 'perfectionist/' + ruleName,\n [\n // Configure the options for every rule, to make inline usage more convenient.\n 'off',\n // These rules don't have a comment partition\n ['sort-heritage-clauses', 'sort-jsx-props', 'sort-switch-case'].includes(ruleName)\n ? { type: 'natural' }\n : { partitionByComment: true, type: 'natural' },\n ],\n ]),\n ),\n\n // Enable sort-jsx-props with callback grouping\n 'perfectionist/sort-jsx-props': [\n 'error',\n {\n customGroups: [\n { elementNamePattern: '^on[A-Z]', groupName: 'callback' },\n { elementNamePattern: '^(key|ref)$', groupName: 'reserved' },\n ],\n groups: ['reserved', 'unknown', 'shorthand-prop', 'callback'],\n ignoreCase: true,\n type: 'unsorted',\n },\n ],\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
export interface PrairieLearnPluginOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Types to allow when using the safe-db-types rule.
|
|
5
|
+
*/
|
|
6
|
+
allowDbTypes?: string[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* PrairieLearn-specific ESLint plugin rules.
|
|
10
|
+
* Includes AWS client configuration, JSX safety, SQL blocks, and database type safety.
|
|
11
|
+
*/
|
|
12
|
+
export declare function prairieLearnConfig(options?: PrairieLearnPluginOptions): TSESLint.FlatConfig.ConfigArray;
|
|
13
|
+
//# sourceMappingURL=prairielearn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prairielearn.d.ts","sourceRoot":"","sources":["../../src/configs/prairielearn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzD,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,CAAC,EAAE,yBAAyB,GAClC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAwBjC","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\n\nimport prairielearn from '@prairielearn/eslint-plugin';\n\nexport interface PrairieLearnPluginOptions {\n /**\n * Types to allow when using the safe-db-types rule.\n */\n allowDbTypes?: string[];\n}\n\n/**\n * PrairieLearn-specific ESLint plugin rules.\n * Includes AWS client configuration, JSX safety, SQL blocks, and database type safety.\n */\nexport function prairieLearnConfig(\n options?: PrairieLearnPluginOptions,\n): TSESLint.FlatConfig.ConfigArray {\n const { allowDbTypes = [] } = options ?? {};\n\n return [\n {\n plugins: {\n '@prairielearn': prairielearn,\n },\n\n rules: {\n '@prairielearn/aws-client-mandatory-config': 'error',\n '@prairielearn/aws-client-shared-config': 'error',\n '@prairielearn/jsx-no-dollar-interpolation': 'error',\n '@prairielearn/no-current-target-in-callback': 'error',\n '@prairielearn/no-unused-sql-blocks': 'error',\n '@prairielearn/safe-db-types': [\n 'error',\n {\n allowDbTypes,\n },\n ],\n },\n },\n ];\n}\n"]}
|