@prairielearn/eslint-config 0.0.1 → 1.1.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/CHANGELOG.md +13 -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
|
@@ -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"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import prairielearn from '@prairielearn/eslint-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* PrairieLearn-specific ESLint plugin rules.
|
|
4
|
+
* Includes AWS client configuration, JSX safety, SQL blocks, and database type safety.
|
|
5
|
+
*/
|
|
6
|
+
export function prairieLearnConfig(options) {
|
|
7
|
+
const { allowDbTypes = [] } = options ?? {};
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
plugins: {
|
|
11
|
+
'@prairielearn': prairielearn,
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
'@prairielearn/aws-client-mandatory-config': 'error',
|
|
15
|
+
'@prairielearn/aws-client-shared-config': 'error',
|
|
16
|
+
'@prairielearn/jsx-no-dollar-interpolation': 'error',
|
|
17
|
+
'@prairielearn/no-current-target-in-callback': 'error',
|
|
18
|
+
'@prairielearn/no-unused-sql-blocks': 'error',
|
|
19
|
+
'@prairielearn/safe-db-types': [
|
|
20
|
+
'error',
|
|
21
|
+
{
|
|
22
|
+
allowDbTypes,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=prairielearn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prairielearn.js","sourceRoot":"","sources":["../../src/configs/prairielearn.ts"],"names":[],"mappings":"AAEA,OAAO,YAAY,MAAM,6BAA6B,CAAC;AASvD;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAmC,EACF;IACjC,MAAM,EAAE,YAAY,GAAG,EAAE,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE5C,OAAO;QACL;YACE,OAAO,EAAE;gBACP,eAAe,EAAE,YAAY;aAC9B;YAED,KAAK,EAAE;gBACL,2CAA2C,EAAE,OAAO;gBACpD,wCAAwC,EAAE,OAAO;gBACjD,2CAA2C,EAAE,OAAO;gBACpD,6CAA6C,EAAE,OAAO;gBACtD,oCAAoC,EAAE,OAAO;gBAC7C,6BAA6B,EAAE;oBAC7B,OAAO;oBACP;wBACE,YAAY;qBACb;iBACF;aACF;SACF;KACF,CAAC;AAAA,CACH","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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/configs/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAYzD;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAiE7D","sourcesContent":["import eslintReact from '@eslint-react/eslint-plugin';\nimport type { TSESLint } from '@typescript-eslint/utils';\nimport jsxA11yX from 'eslint-plugin-jsx-a11y-x';\nimport reactHooks from 'eslint-plugin-react-hooks';\nimport reactYouMightNotNeedAnEffect from 'eslint-plugin-react-you-might-not-need-an-effect';\n\n// The eslint-react config has plugins/settings/rules but the type doesn't expose them all\nconst eslintReactConfig = eslintReact.configs['recommended-typescript'] as {\n plugins?: TSESLint.FlatConfig.Plugins;\n rules?: TSESLint.FlatConfig.Rules;\n settings?: TSESLint.FlatConfig.Settings;\n};\n\n/**\n * React, React hooks, accessibility, and related rules.\n */\nexport function reactConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n 'jsx-a11y-x': jsxA11yX,\n 'react-hooks': reactHooks,\n 'react-you-might-not-need-an-effect': reactYouMightNotNeedAnEffect,\n ...eslintReactConfig.plugins,\n },\n\n rules: {\n // React hooks\n 'react-hooks/exhaustive-deps': 'error',\n 'react-hooks/rules-of-hooks': 'error',\n\n // react-you-might-not-need-an-effect rules as errors\n ...Object.fromEntries(\n Object.keys(reactYouMightNotNeedAnEffect.configs?.recommended?.rules ?? {}).map(\n (ruleName: string) => [ruleName, 'error'],\n ),\n ),\n\n // eslint-react recommended rules as errors\n ...Object.fromEntries(\n Object.entries(eslintReactConfig.rules ?? {}).map(\n ([ruleName, severity]: [string, unknown]) => [\n ruleName,\n severity === 'off' ? 'off' : 'error',\n ],\n ),\n ),\n // We want to be able to use `useState` without the setter function for\n // https://tkdodo.eu/blog/react-query-fa-qs#2-the-queryclient-is-not-stable\n '@eslint-react/naming-convention/use-state': 'off',\n // Forbid `snake_case` props.\n '@eslint-react/no-forbidden-props': ['error', { forbid: ['/_/'] }],\n\n // jsx-a11y strict rules\n ...jsxA11yX.configs.strict.rules,\n 'jsx-a11y-x/anchor-ambiguous-text': 'error',\n 'jsx-a11y-x/lang': 'error',\n 'jsx-a11y-x/no-aria-hidden-on-focusable': 'error',\n // Bootstrap turns some elements into interactive elements.\n 'jsx-a11y-x/no-noninteractive-element-to-interactive-role': [\n 'error',\n {\n li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],\n ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],\n table: ['grid'],\n td: ['gridcell'],\n ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid', 'role'],\n },\n ],\n },\n\n settings: {\n 'jsx-a11y-x': {\n attributes: {\n for: ['htmlFor'],\n },\n },\n ...eslintReactConfig.settings,\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import eslintReact from '@eslint-react/eslint-plugin';
|
|
2
|
+
import jsxA11yX from 'eslint-plugin-jsx-a11y-x';
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
4
|
+
import reactYouMightNotNeedAnEffect from 'eslint-plugin-react-you-might-not-need-an-effect';
|
|
5
|
+
// The eslint-react config has plugins/settings/rules but the type doesn't expose them all
|
|
6
|
+
const eslintReactConfig = eslintReact.configs['recommended-typescript'];
|
|
7
|
+
/**
|
|
8
|
+
* React, React hooks, accessibility, and related rules.
|
|
9
|
+
*/
|
|
10
|
+
export function reactConfig() {
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
plugins: {
|
|
14
|
+
'jsx-a11y-x': jsxA11yX,
|
|
15
|
+
'react-hooks': reactHooks,
|
|
16
|
+
'react-you-might-not-need-an-effect': reactYouMightNotNeedAnEffect,
|
|
17
|
+
...eslintReactConfig.plugins,
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
// React hooks
|
|
21
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
22
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
23
|
+
// react-you-might-not-need-an-effect rules as errors
|
|
24
|
+
...Object.fromEntries(Object.keys(reactYouMightNotNeedAnEffect.configs?.recommended?.rules ?? {}).map((ruleName) => [ruleName, 'error'])),
|
|
25
|
+
// eslint-react recommended rules as errors
|
|
26
|
+
...Object.fromEntries(Object.entries(eslintReactConfig.rules ?? {}).map(([ruleName, severity]) => [
|
|
27
|
+
ruleName,
|
|
28
|
+
severity === 'off' ? 'off' : 'error',
|
|
29
|
+
])),
|
|
30
|
+
// We want to be able to use `useState` without the setter function for
|
|
31
|
+
// https://tkdodo.eu/blog/react-query-fa-qs#2-the-queryclient-is-not-stable
|
|
32
|
+
'@eslint-react/naming-convention/use-state': 'off',
|
|
33
|
+
// Forbid `snake_case` props.
|
|
34
|
+
'@eslint-react/no-forbidden-props': ['error', { forbid: ['/_/'] }],
|
|
35
|
+
// jsx-a11y strict rules
|
|
36
|
+
...jsxA11yX.configs.strict.rules,
|
|
37
|
+
'jsx-a11y-x/anchor-ambiguous-text': 'error',
|
|
38
|
+
'jsx-a11y-x/lang': 'error',
|
|
39
|
+
'jsx-a11y-x/no-aria-hidden-on-focusable': 'error',
|
|
40
|
+
// Bootstrap turns some elements into interactive elements.
|
|
41
|
+
'jsx-a11y-x/no-noninteractive-element-to-interactive-role': [
|
|
42
|
+
'error',
|
|
43
|
+
{
|
|
44
|
+
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
|
45
|
+
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
46
|
+
table: ['grid'],
|
|
47
|
+
td: ['gridcell'],
|
|
48
|
+
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid', 'role'],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
settings: {
|
|
53
|
+
'jsx-a11y-x': {
|
|
54
|
+
attributes: {
|
|
55
|
+
for: ['htmlFor'],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
...eslintReactConfig.settings,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/configs/react.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,6BAA6B,CAAC;AAEtD,OAAO,QAAQ,MAAM,0BAA0B,CAAC;AAChD,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,4BAA4B,MAAM,kDAAkD,CAAC;AAE5F,0FAA0F;AAC1F,MAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,CAAC,wBAAwB,CAIrE,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,WAAW,GAAoC;IAC7D,OAAO;QACL;YACE,OAAO,EAAE;gBACP,YAAY,EAAE,QAAQ;gBACtB,aAAa,EAAE,UAAU;gBACzB,oCAAoC,EAAE,4BAA4B;gBAClE,GAAG,iBAAiB,CAAC,OAAO;aAC7B;YAED,KAAK,EAAE;gBACL,cAAc;gBACd,6BAA6B,EAAE,OAAO;gBACtC,4BAA4B,EAAE,OAAO;gBAErC,qDAAqD;gBACrD,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAC7E,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAC1C,CACF;gBAED,2CAA2C;gBAC3C,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAC/C,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAoB,EAAE,EAAE,CAAC;oBAC3C,QAAQ;oBACR,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO;iBACrC,CACF,CACF;gBACD,uEAAuE;gBACvE,2EAA2E;gBAC3E,2CAA2C,EAAE,KAAK;gBAClD,6BAA6B;gBAC7B,kCAAkC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAElE,wBAAwB;gBACxB,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;gBAChC,kCAAkC,EAAE,OAAO;gBAC3C,iBAAiB,EAAE,OAAO;gBAC1B,wCAAwC,EAAE,OAAO;gBACjD,2DAA2D;gBAC3D,0DAA0D,EAAE;oBAC1D,OAAO;oBACP;wBACE,EAAE,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;wBACpD,EAAE,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC;wBAC/E,KAAK,EAAE,CAAC,MAAM,CAAC;wBACf,EAAE,EAAE,CAAC,UAAU,CAAC;wBAChB,EAAE,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC;qBACxF;iBACF;aACF;YAED,QAAQ,EAAE;gBACR,YAAY,EAAE;oBACZ,UAAU,EAAE;wBACV,GAAG,EAAE,CAAC,SAAS,CAAC;qBACjB;iBACF;gBACD,GAAG,iBAAiB,CAAC,QAAQ;aAC9B;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import eslintReact from '@eslint-react/eslint-plugin';\nimport type { TSESLint } from '@typescript-eslint/utils';\nimport jsxA11yX from 'eslint-plugin-jsx-a11y-x';\nimport reactHooks from 'eslint-plugin-react-hooks';\nimport reactYouMightNotNeedAnEffect from 'eslint-plugin-react-you-might-not-need-an-effect';\n\n// The eslint-react config has plugins/settings/rules but the type doesn't expose them all\nconst eslintReactConfig = eslintReact.configs['recommended-typescript'] as {\n plugins?: TSESLint.FlatConfig.Plugins;\n rules?: TSESLint.FlatConfig.Rules;\n settings?: TSESLint.FlatConfig.Settings;\n};\n\n/**\n * React, React hooks, accessibility, and related rules.\n */\nexport function reactConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n 'jsx-a11y-x': jsxA11yX,\n 'react-hooks': reactHooks,\n 'react-you-might-not-need-an-effect': reactYouMightNotNeedAnEffect,\n ...eslintReactConfig.plugins,\n },\n\n rules: {\n // React hooks\n 'react-hooks/exhaustive-deps': 'error',\n 'react-hooks/rules-of-hooks': 'error',\n\n // react-you-might-not-need-an-effect rules as errors\n ...Object.fromEntries(\n Object.keys(reactYouMightNotNeedAnEffect.configs?.recommended?.rules ?? {}).map(\n (ruleName: string) => [ruleName, 'error'],\n ),\n ),\n\n // eslint-react recommended rules as errors\n ...Object.fromEntries(\n Object.entries(eslintReactConfig.rules ?? {}).map(\n ([ruleName, severity]: [string, unknown]) => [\n ruleName,\n severity === 'off' ? 'off' : 'error',\n ],\n ),\n ),\n // We want to be able to use `useState` without the setter function for\n // https://tkdodo.eu/blog/react-query-fa-qs#2-the-queryclient-is-not-stable\n '@eslint-react/naming-convention/use-state': 'off',\n // Forbid `snake_case` props.\n '@eslint-react/no-forbidden-props': ['error', { forbid: ['/_/'] }],\n\n // jsx-a11y strict rules\n ...jsxA11yX.configs.strict.rules,\n 'jsx-a11y-x/anchor-ambiguous-text': 'error',\n 'jsx-a11y-x/lang': 'error',\n 'jsx-a11y-x/no-aria-hidden-on-focusable': 'error',\n // Bootstrap turns some elements into interactive elements.\n 'jsx-a11y-x/no-noninteractive-element-to-interactive-role': [\n 'error',\n {\n li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],\n ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],\n table: ['grid'],\n td: ['gridcell'],\n ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid', 'role'],\n },\n ],\n },\n\n settings: {\n 'jsx-a11y-x': {\n attributes: {\n for: ['htmlFor'],\n },\n },\n ...eslintReactConfig.settings,\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylistic.d.ts","sourceRoot":"","sources":["../../src/configs/stylistic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;GAEG;AACH,wBAAgB,eAAe,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CA+CjE","sourcesContent":["import stylistic from '@stylistic/eslint-plugin';\nimport type { TSESLint } from '@typescript-eslint/utils';\n\n/**\n * Stylistic formatting rules.\n */\nexport function stylisticConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n '@stylistic': stylistic,\n },\n\n rules: {\n '@stylistic/jsx-curly-brace-presence': [\n 'error',\n { children: 'never', propElementValues: 'always', props: 'never' },\n ],\n\n '@stylistic/jsx-self-closing-comp': [\n 'error',\n {\n component: true,\n html: true,\n },\n ],\n '@stylistic/jsx-tag-spacing': [\n 'error',\n {\n afterOpening: 'never',\n beforeClosing: 'allow',\n beforeSelfClosing: 'always',\n closingSlash: 'never',\n },\n ],\n '@stylistic/lines-between-class-members': [\n 'error',\n 'always',\n { exceptAfterSingleLine: true },\n ],\n '@stylistic/no-tabs': 'error',\n '@stylistic/padding-line-between-statements': [\n 'error',\n { blankLine: 'always', next: 'function', prev: '*' },\n { blankLine: 'always', next: '*', prev: 'import' },\n { blankLine: 'any', next: 'import', prev: 'import' },\n ],\n // Blocks double-quote strings (unless a single quote is present in the\n // string) and backticks (unless there is a tag or substitution in place).\n '@stylistic/quotes': ['error', 'single', { avoidEscape: true }],\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Stylistic formatting rules.
|
|
4
|
+
*/
|
|
5
|
+
export function stylisticConfig() {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
plugins: {
|
|
9
|
+
'@stylistic': stylistic,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
'@stylistic/jsx-curly-brace-presence': [
|
|
13
|
+
'error',
|
|
14
|
+
{ children: 'never', propElementValues: 'always', props: 'never' },
|
|
15
|
+
],
|
|
16
|
+
'@stylistic/jsx-self-closing-comp': [
|
|
17
|
+
'error',
|
|
18
|
+
{
|
|
19
|
+
component: true,
|
|
20
|
+
html: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
'@stylistic/jsx-tag-spacing': [
|
|
24
|
+
'error',
|
|
25
|
+
{
|
|
26
|
+
afterOpening: 'never',
|
|
27
|
+
beforeClosing: 'allow',
|
|
28
|
+
beforeSelfClosing: 'always',
|
|
29
|
+
closingSlash: 'never',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
'@stylistic/lines-between-class-members': [
|
|
33
|
+
'error',
|
|
34
|
+
'always',
|
|
35
|
+
{ exceptAfterSingleLine: true },
|
|
36
|
+
],
|
|
37
|
+
'@stylistic/no-tabs': 'error',
|
|
38
|
+
'@stylistic/padding-line-between-statements': [
|
|
39
|
+
'error',
|
|
40
|
+
{ blankLine: 'always', next: 'function', prev: '*' },
|
|
41
|
+
{ blankLine: 'always', next: '*', prev: 'import' },
|
|
42
|
+
{ blankLine: 'any', next: 'import', prev: 'import' },
|
|
43
|
+
],
|
|
44
|
+
// Blocks double-quote strings (unless a single quote is present in the
|
|
45
|
+
// string) and backticks (unless there is a tag or substitution in place).
|
|
46
|
+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=stylistic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylistic.js","sourceRoot":"","sources":["../../src/configs/stylistic.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,0BAA0B,CAAC;AAGjD;;GAEG;AACH,MAAM,UAAU,eAAe,GAAoC;IACjE,OAAO;QACL;YACE,OAAO,EAAE;gBACP,YAAY,EAAE,SAAS;aACxB;YAED,KAAK,EAAE;gBACL,qCAAqC,EAAE;oBACrC,OAAO;oBACP,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;iBACnE;gBAED,kCAAkC,EAAE;oBAClC,OAAO;oBACP;wBACE,SAAS,EAAE,IAAI;wBACf,IAAI,EAAE,IAAI;qBACX;iBACF;gBACD,4BAA4B,EAAE;oBAC5B,OAAO;oBACP;wBACE,YAAY,EAAE,OAAO;wBACrB,aAAa,EAAE,OAAO;wBACtB,iBAAiB,EAAE,QAAQ;wBAC3B,YAAY,EAAE,OAAO;qBACtB;iBACF;gBACD,wCAAwC,EAAE;oBACxC,OAAO;oBACP,QAAQ;oBACR,EAAE,qBAAqB,EAAE,IAAI,EAAE;iBAChC;gBACD,oBAAoB,EAAE,OAAO;gBAC7B,4CAA4C,EAAE;oBAC5C,OAAO;oBACP,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE;oBACpD,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAClD,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;iBACrD;gBACD,uEAAuE;gBACvE,0EAA0E;gBAC1E,mBAAmB,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;aAChE;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import stylistic from '@stylistic/eslint-plugin';\nimport type { TSESLint } from '@typescript-eslint/utils';\n\n/**\n * Stylistic formatting rules.\n */\nexport function stylisticConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n '@stylistic': stylistic,\n },\n\n rules: {\n '@stylistic/jsx-curly-brace-presence': [\n 'error',\n { children: 'never', propElementValues: 'always', props: 'never' },\n ],\n\n '@stylistic/jsx-self-closing-comp': [\n 'error',\n {\n component: true,\n html: true,\n },\n ],\n '@stylistic/jsx-tag-spacing': [\n 'error',\n {\n afterOpening: 'never',\n beforeClosing: 'allow',\n beforeSelfClosing: 'always',\n closingSlash: 'never',\n },\n ],\n '@stylistic/lines-between-class-members': [\n 'error',\n 'always',\n { exceptAfterSingleLine: true },\n ],\n '@stylistic/no-tabs': 'error',\n '@stylistic/padding-line-between-statements': [\n 'error',\n { blankLine: 'always', next: 'function', prev: '*' },\n { blankLine: 'always', next: '*', prev: 'import' },\n { blankLine: 'any', next: 'import', prev: 'import' },\n ],\n // Blocks double-quote strings (unless a single quote is present in the\n // string) and backticks (unless there is a tag or substitution in place).\n '@stylistic/quotes': ['error', 'single', { avoidEscape: true }],\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanstack.d.ts","sourceRoot":"","sources":["../../src/configs/tanstack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;GAEG;AACH,wBAAgB,cAAc,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAchE","sourcesContent":["import pluginQuery from '@tanstack/eslint-plugin-query';\nimport type { TSESLint } from '@typescript-eslint/utils';\n\n/**\n * TanStack Query (React Query) rules.\n */\nexport function tanstackConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n '@tanstack/query': pluginQuery,\n },\n\n rules: {\n // https://github.com/TanStack/query/blob/6402d756b702ac560b69a5ce84d6e4e764b96451/packages/eslint-plugin-query/src/index.ts#L43\n ...pluginQuery.configs['flat/recommended'][0].rules,\n '@tanstack/query/no-rest-destructuring': 'error',\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import pluginQuery from '@tanstack/eslint-plugin-query';
|
|
2
|
+
/**
|
|
3
|
+
* TanStack Query (React Query) rules.
|
|
4
|
+
*/
|
|
5
|
+
export function tanstackConfig() {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
plugins: {
|
|
9
|
+
'@tanstack/query': pluginQuery,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
// https://github.com/TanStack/query/blob/6402d756b702ac560b69a5ce84d6e4e764b96451/packages/eslint-plugin-query/src/index.ts#L43
|
|
13
|
+
...pluginQuery.configs['flat/recommended'][0].rules,
|
|
14
|
+
'@tanstack/query/no-rest-destructuring': 'error',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tanstack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanstack.js","sourceRoot":"","sources":["../../src/configs/tanstack.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,+BAA+B,CAAC;AAGxD;;GAEG;AACH,MAAM,UAAU,cAAc,GAAoC;IAChE,OAAO;QACL;YACE,OAAO,EAAE;gBACP,iBAAiB,EAAE,WAAW;aAC/B;YAED,KAAK,EAAE;gBACL,gIAAgI;gBAChI,GAAG,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;gBACnD,uCAAuC,EAAE,OAAO;aACjD;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import pluginQuery from '@tanstack/eslint-plugin-query';\nimport type { TSESLint } from '@typescript-eslint/utils';\n\n/**\n * TanStack Query (React Query) rules.\n */\nexport function tanstackConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n '@tanstack/query': pluginQuery,\n },\n\n rules: {\n // https://github.com/TanStack/query/blob/6402d756b702ac560b69a5ce84d6e4e764b96451/packages/eslint-plugin-query/src/index.ts#L43\n ...pluginQuery.configs['flat/recommended'][0].rules,\n '@tanstack/query/no-rest-destructuring': 'error',\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
/**
|
|
3
|
+
* TypeScript-specific rules (non-type-aware).
|
|
4
|
+
*/
|
|
5
|
+
export declare function typescriptConfig(): TSESLint.FlatConfig.ConfigArray;
|
|
6
|
+
/**
|
|
7
|
+
* Type-aware TypeScript rules.
|
|
8
|
+
* These require a tsconfig.json to be configured.
|
|
9
|
+
*/
|
|
10
|
+
export declare function typescriptTypeAwareRules(): TSESLint.FlatConfig.Rules;
|
|
11
|
+
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/configs/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CA4BlE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,CAoEpE","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\n\n/**\n * TypeScript-specific rules (non-type-aware).\n */\nexport function typescriptConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n rules: {\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n { fixStyle: 'inline-type-imports' },\n ],\n // We use empty functions in quite a few places, so we'll disable this rule.\n '@typescript-eslint/no-empty-function': 'off',\n // Look, sometimes we just want to use `any`.\n '@typescript-eslint/no-explicit-any': 'off',\n // This was enabled when we upgraded to `@typescript-eslint/*` v6.\n '@typescript-eslint/no-dynamic-delete': 'off',\n // We use `!` to assert that a value is not `null` or `undefined`.\n '@typescript-eslint/no-non-null-assertion': 'off',\n // Replaces the standard `no-unused-vars` rule.\n '@typescript-eslint/no-unused-vars': [\n 'error',\n {\n args: 'after-used',\n argsIgnorePattern: '^_', // Args can be _\n varsIgnorePattern: '^_.', // This includes lodash, which should be considered\n },\n ],\n },\n },\n ];\n}\n\n/**\n * Type-aware TypeScript rules.\n * These require a tsconfig.json to be configured.\n */\nexport function typescriptTypeAwareRules(): TSESLint.FlatConfig.Rules {\n return {\n '@typescript-eslint/no-base-to-string': 'off',\n '@typescript-eslint/no-invalid-void-type': [\n 'error',\n {\n allowAsThisParameter: true,\n },\n ],\n '@typescript-eslint/no-unsafe-argument': 'off',\n '@typescript-eslint/no-unsafe-assignment': 'off',\n '@typescript-eslint/no-unsafe-call': 'off',\n '@typescript-eslint/no-unsafe-member-access': 'off',\n '@typescript-eslint/no-unsafe-return': 'off',\n // Some functions are required to be async, but don't actually use any async code.\n '@typescript-eslint/require-await': 'off',\n // We don't always check that we got a error when a promise is rejected.\n '@typescript-eslint/no-misused-promises': [\n 'error',\n {\n checksConditionals: true,\n checksSpreads: true,\n checksVoidReturn: {\n // Common usage with `async` functions\n arguments: false,\n // Common usage with `async` onClick handlers\n attributes: false,\n inheritedMethods: true,\n // Common usage with e.g. setState\n properties: false,\n returns: true,\n variables: true,\n },\n },\n ],\n '@typescript-eslint/no-unnecessary-condition': [\n 'error',\n { allowConstantLoopConditions: 'only-allowed-literals' },\n ],\n '@typescript-eslint/only-throw-error': [\n 'error',\n {\n allow: [\n {\n from: 'file',\n name: 'HttpRedirect',\n },\n ],\n allowRethrowing: true,\n allowThrowingAny: true,\n allowThrowingUnknown: true,\n },\n ],\n '@typescript-eslint/prefer-nullish-coalescing': 'off',\n '@typescript-eslint/prefer-promise-reject-errors': 'off',\n '@typescript-eslint/prefer-regexp-exec': 'off',\n '@typescript-eslint/restrict-template-expressions': [\n 'error',\n {\n allow: [{ from: 'lib', name: ['Error', 'URL', 'URLSearchParams'] }],\n allowAny: true,\n allowBoolean: true,\n allowNullish: true,\n allowNumber: true,\n allowRegExp: true,\n },\n ],\n };\n}\n"]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript-specific rules (non-type-aware).
|
|
3
|
+
*/
|
|
4
|
+
export function typescriptConfig() {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
rules: {
|
|
8
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
9
|
+
'error',
|
|
10
|
+
{ fixStyle: 'inline-type-imports' },
|
|
11
|
+
],
|
|
12
|
+
// We use empty functions in quite a few places, so we'll disable this rule.
|
|
13
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
14
|
+
// Look, sometimes we just want to use `any`.
|
|
15
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
16
|
+
// This was enabled when we upgraded to `@typescript-eslint/*` v6.
|
|
17
|
+
'@typescript-eslint/no-dynamic-delete': 'off',
|
|
18
|
+
// We use `!` to assert that a value is not `null` or `undefined`.
|
|
19
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
20
|
+
// Replaces the standard `no-unused-vars` rule.
|
|
21
|
+
'@typescript-eslint/no-unused-vars': [
|
|
22
|
+
'error',
|
|
23
|
+
{
|
|
24
|
+
args: 'after-used',
|
|
25
|
+
argsIgnorePattern: '^_', // Args can be _
|
|
26
|
+
varsIgnorePattern: '^_.', // This includes lodash, which should be considered
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Type-aware TypeScript rules.
|
|
35
|
+
* These require a tsconfig.json to be configured.
|
|
36
|
+
*/
|
|
37
|
+
export function typescriptTypeAwareRules() {
|
|
38
|
+
return {
|
|
39
|
+
'@typescript-eslint/no-base-to-string': 'off',
|
|
40
|
+
'@typescript-eslint/no-invalid-void-type': [
|
|
41
|
+
'error',
|
|
42
|
+
{
|
|
43
|
+
allowAsThisParameter: true,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
47
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
48
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
49
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
50
|
+
'@typescript-eslint/no-unsafe-return': 'off',
|
|
51
|
+
// Some functions are required to be async, but don't actually use any async code.
|
|
52
|
+
'@typescript-eslint/require-await': 'off',
|
|
53
|
+
// We don't always check that we got a error when a promise is rejected.
|
|
54
|
+
'@typescript-eslint/no-misused-promises': [
|
|
55
|
+
'error',
|
|
56
|
+
{
|
|
57
|
+
checksConditionals: true,
|
|
58
|
+
checksSpreads: true,
|
|
59
|
+
checksVoidReturn: {
|
|
60
|
+
// Common usage with `async` functions
|
|
61
|
+
arguments: false,
|
|
62
|
+
// Common usage with `async` onClick handlers
|
|
63
|
+
attributes: false,
|
|
64
|
+
inheritedMethods: true,
|
|
65
|
+
// Common usage with e.g. setState
|
|
66
|
+
properties: false,
|
|
67
|
+
returns: true,
|
|
68
|
+
variables: true,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
'@typescript-eslint/no-unnecessary-condition': [
|
|
73
|
+
'error',
|
|
74
|
+
{ allowConstantLoopConditions: 'only-allowed-literals' },
|
|
75
|
+
],
|
|
76
|
+
'@typescript-eslint/only-throw-error': [
|
|
77
|
+
'error',
|
|
78
|
+
{
|
|
79
|
+
allow: [
|
|
80
|
+
{
|
|
81
|
+
from: 'file',
|
|
82
|
+
name: 'HttpRedirect',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
allowRethrowing: true,
|
|
86
|
+
allowThrowingAny: true,
|
|
87
|
+
allowThrowingUnknown: true,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
91
|
+
'@typescript-eslint/prefer-promise-reject-errors': 'off',
|
|
92
|
+
'@typescript-eslint/prefer-regexp-exec': 'off',
|
|
93
|
+
'@typescript-eslint/restrict-template-expressions': [
|
|
94
|
+
'error',
|
|
95
|
+
{
|
|
96
|
+
allow: [{ from: 'lib', name: ['Error', 'URL', 'URLSearchParams'] }],
|
|
97
|
+
allowAny: true,
|
|
98
|
+
allowBoolean: true,
|
|
99
|
+
allowNullish: true,
|
|
100
|
+
allowNumber: true,
|
|
101
|
+
allowRegExp: true,
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/configs/typescript.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,gBAAgB,GAAoC;IAClE,OAAO;QACL;YACE,KAAK,EAAE;gBACL,4CAA4C,EAAE;oBAC5C,OAAO;oBACP,EAAE,QAAQ,EAAE,qBAAqB,EAAE;iBACpC;gBACD,4EAA4E;gBAC5E,sCAAsC,EAAE,KAAK;gBAC7C,6CAA6C;gBAC7C,oCAAoC,EAAE,KAAK;gBAC3C,kEAAkE;gBAClE,sCAAsC,EAAE,KAAK;gBAC7C,kEAAkE;gBAClE,0CAA0C,EAAE,KAAK;gBACjD,+CAA+C;gBAC/C,mCAAmC,EAAE;oBACnC,OAAO;oBACP;wBACE,IAAI,EAAE,YAAY;wBAClB,iBAAiB,EAAE,IAAI,EAAE,gBAAgB;wBACzC,iBAAiB,EAAE,KAAK,EAAE,mDAAmD;qBAC9E;iBACF;aACF;SACF;KACF,CAAC;AAAA,CACH;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,GAA8B;IACpE,OAAO;QACL,sCAAsC,EAAE,KAAK;QAC7C,yCAAyC,EAAE;YACzC,OAAO;YACP;gBACE,oBAAoB,EAAE,IAAI;aAC3B;SACF;QACD,uCAAuC,EAAE,KAAK;QAC9C,yCAAyC,EAAE,KAAK;QAChD,mCAAmC,EAAE,KAAK;QAC1C,4CAA4C,EAAE,KAAK;QACnD,qCAAqC,EAAE,KAAK;QAC5C,kFAAkF;QAClF,kCAAkC,EAAE,KAAK;QACzC,wEAAwE;QACxE,wCAAwC,EAAE;YACxC,OAAO;YACP;gBACE,kBAAkB,EAAE,IAAI;gBACxB,aAAa,EAAE,IAAI;gBACnB,gBAAgB,EAAE;oBAChB,sCAAsC;oBACtC,SAAS,EAAE,KAAK;oBAChB,6CAA6C;oBAC7C,UAAU,EAAE,KAAK;oBACjB,gBAAgB,EAAE,IAAI;oBACtB,kCAAkC;oBAClC,UAAU,EAAE,KAAK;oBACjB,OAAO,EAAE,IAAI;oBACb,SAAS,EAAE,IAAI;iBAChB;aACF;SACF;QACD,6CAA6C,EAAE;YAC7C,OAAO;YACP,EAAE,2BAA2B,EAAE,uBAAuB,EAAE;SACzD;QACD,qCAAqC,EAAE;YACrC,OAAO;YACP;gBACE,KAAK,EAAE;oBACL;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,cAAc;qBACrB;iBACF;gBACD,eAAe,EAAE,IAAI;gBACrB,gBAAgB,EAAE,IAAI;gBACtB,oBAAoB,EAAE,IAAI;aAC3B;SACF;QACD,8CAA8C,EAAE,KAAK;QACrD,iDAAiD,EAAE,KAAK;QACxD,uCAAuC,EAAE,KAAK;QAC9C,kDAAkD,EAAE;YAClD,OAAO;YACP;gBACE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC;gBACnE,QAAQ,EAAE,IAAI;gBACd,YAAY,EAAE,IAAI;gBAClB,YAAY,EAAE,IAAI;gBAClB,WAAW,EAAE,IAAI;gBACjB,WAAW,EAAE,IAAI;aAClB;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\n\n/**\n * TypeScript-specific rules (non-type-aware).\n */\nexport function typescriptConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n rules: {\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n { fixStyle: 'inline-type-imports' },\n ],\n // We use empty functions in quite a few places, so we'll disable this rule.\n '@typescript-eslint/no-empty-function': 'off',\n // Look, sometimes we just want to use `any`.\n '@typescript-eslint/no-explicit-any': 'off',\n // This was enabled when we upgraded to `@typescript-eslint/*` v6.\n '@typescript-eslint/no-dynamic-delete': 'off',\n // We use `!` to assert that a value is not `null` or `undefined`.\n '@typescript-eslint/no-non-null-assertion': 'off',\n // Replaces the standard `no-unused-vars` rule.\n '@typescript-eslint/no-unused-vars': [\n 'error',\n {\n args: 'after-used',\n argsIgnorePattern: '^_', // Args can be _\n varsIgnorePattern: '^_.', // This includes lodash, which should be considered\n },\n ],\n },\n },\n ];\n}\n\n/**\n * Type-aware TypeScript rules.\n * These require a tsconfig.json to be configured.\n */\nexport function typescriptTypeAwareRules(): TSESLint.FlatConfig.Rules {\n return {\n '@typescript-eslint/no-base-to-string': 'off',\n '@typescript-eslint/no-invalid-void-type': [\n 'error',\n {\n allowAsThisParameter: true,\n },\n ],\n '@typescript-eslint/no-unsafe-argument': 'off',\n '@typescript-eslint/no-unsafe-assignment': 'off',\n '@typescript-eslint/no-unsafe-call': 'off',\n '@typescript-eslint/no-unsafe-member-access': 'off',\n '@typescript-eslint/no-unsafe-return': 'off',\n // Some functions are required to be async, but don't actually use any async code.\n '@typescript-eslint/require-await': 'off',\n // We don't always check that we got a error when a promise is rejected.\n '@typescript-eslint/no-misused-promises': [\n 'error',\n {\n checksConditionals: true,\n checksSpreads: true,\n checksVoidReturn: {\n // Common usage with `async` functions\n arguments: false,\n // Common usage with `async` onClick handlers\n attributes: false,\n inheritedMethods: true,\n // Common usage with e.g. setState\n properties: false,\n returns: true,\n variables: true,\n },\n },\n ],\n '@typescript-eslint/no-unnecessary-condition': [\n 'error',\n { allowConstantLoopConditions: 'only-allowed-literals' },\n ],\n '@typescript-eslint/only-throw-error': [\n 'error',\n {\n allow: [\n {\n from: 'file',\n name: 'HttpRedirect',\n },\n ],\n allowRethrowing: true,\n allowThrowingAny: true,\n allowThrowingUnknown: true,\n },\n ],\n '@typescript-eslint/prefer-nullish-coalescing': 'off',\n '@typescript-eslint/prefer-promise-reject-errors': 'off',\n '@typescript-eslint/prefer-regexp-exec': 'off',\n '@typescript-eslint/restrict-template-expressions': [\n 'error',\n {\n allow: [{ from: 'lib', name: ['Error', 'URL', 'URLSearchParams'] }],\n allowAny: true,\n allowBoolean: true,\n allowNullish: true,\n allowNumber: true,\n allowRegExp: true,\n },\n ],\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../src/configs/unicorn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;GAEG;AACH,wBAAgB,aAAa,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CA6E/D","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport eslintPluginUnicorn from 'eslint-plugin-unicorn';\n\n/**\n * Unicorn plugin rules with PrairieLearn-specific overrides.\n */\nexport function unicornConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n unicorn: eslintPluginUnicorn,\n },\n\n rules: {\n ...eslintPluginUnicorn.configs.recommended.rules,\n\n // These rules don't align with our own style guidelines\n 'unicorn/filename-case': 'off', // We don't enforce specific styles for filenames\n 'unicorn/no-anonymous-default-export': 'off', // We use this for all of our pages\n 'unicorn/no-array-callback-reference': 'off',\n 'unicorn/no-array-method-this-argument': 'off',\n 'unicorn/no-array-reduce': 'off', // Sometimes, an array reduce is more readable\n 'unicorn/no-array-reverse': 'off', // `Array.prototype.toReversed` is not yet supported by our TypeScript config\n 'unicorn/no-array-sort': 'off', // Disabling for the time being to avoid unnecessary diffs\n 'unicorn/no-hex-escape': 'off',\n 'unicorn/no-lonely-if': 'off', // https://github.com/PrairieLearn/PrairieLearn/pull/12546#discussion_r2252261293\n 'unicorn/no-null': 'off',\n 'unicorn/no-useless-undefined': 'off', // Explicit undefined is more readable than implicit undefined\n 'unicorn/prefer-code-point': 'off',\n 'unicorn/prefer-dom-node-dataset': 'off', // https://github.com/PrairieLearn/PrairieLearn/pull/12546#discussion_r2261095992\n 'unicorn/prefer-export-from': 'off', // https://github.com/PrairieLearn/PrairieLearn/pull/12546#discussion_r2252265000\n 'unicorn/prefer-string-raw': 'off', // We don't use `String.raw` in our codebase\n 'unicorn/prefer-ternary': 'off', // if/else can be more readable than a ternary\n 'unicorn/prefer-top-level-await': 'off', // we use this on a lot of pages\n 'unicorn/prefer-type-error': 'off',\n 'unicorn/prevent-abbreviations': 'off',\n\n // These rules have many violations. Decisions about enabling the rules have been deferred.\n 'unicorn/catch-error-name': 'off', // 200+ violations\n 'unicorn/no-array-for-each': 'off', // 300+ violations\n 'unicorn/no-await-expression-member': 'off', // 400+ violations\n 'unicorn/no-negated-condition': 'off', // 150+ violations\n 'unicorn/prefer-global-this': 'off', // 150+ violations\n 'unicorn/prefer-node-protocol': 'off', // 100+ violations\n 'unicorn/switch-case-braces': 'off', // 200+ violations\n\n // TODO: investigate, < 100 violations\n 'unicorn/consistent-assert': 'off',\n 'unicorn/consistent-function-scoping': 'off',\n 'unicorn/escape-case': 'off',\n 'unicorn/import-style': 'off',\n 'unicorn/numeric-separators-style': 'off',\n 'unicorn/prefer-query-selector': 'off',\n 'unicorn/prefer-spread': 'off',\n 'unicorn/prefer-switch': 'off',\n 'unicorn/text-encoding-identifier-case': 'off',\n\n // TODO: investigated and manual fixes are required\n 'unicorn/no-object-as-default-parameter': 'off',\n 'unicorn/prefer-add-event-listener': 'off',\n 'unicorn/prefer-dom-node-text-content': 'off',\n 'unicorn/prefer-event-target': 'off',\n\n // False positives\n 'unicorn/error-message': 'off',\n 'unicorn/prefer-at': 'off', // https://github.com/microsoft/TypeScript/issues/47660#issuecomment-3146907649\n 'unicorn/throw-new-error': 'off',\n\n // Duplicated from other lint rules\n 'unicorn/no-static-only-class': 'off',\n 'unicorn/no-this-assignment': 'off',\n 'unicorn/prefer-module': 'off',\n\n // https://github.com/PrairieLearn/PrairieLearn/pull/12545/files#r2252069292\n 'unicorn/no-for-loop': 'off',\n\n // Conflicts with prettier\n 'unicorn/no-nested-ternary': 'off',\n 'unicorn/number-literal-case': 'off',\n 'unicorn/template-indent': 'off',\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
|
2
|
+
/**
|
|
3
|
+
* Unicorn plugin rules with PrairieLearn-specific overrides.
|
|
4
|
+
*/
|
|
5
|
+
export function unicornConfig() {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
plugins: {
|
|
9
|
+
unicorn: eslintPluginUnicorn,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
...eslintPluginUnicorn.configs.recommended.rules,
|
|
13
|
+
// These rules don't align with our own style guidelines
|
|
14
|
+
'unicorn/filename-case': 'off', // We don't enforce specific styles for filenames
|
|
15
|
+
'unicorn/no-anonymous-default-export': 'off', // We use this for all of our pages
|
|
16
|
+
'unicorn/no-array-callback-reference': 'off',
|
|
17
|
+
'unicorn/no-array-method-this-argument': 'off',
|
|
18
|
+
'unicorn/no-array-reduce': 'off', // Sometimes, an array reduce is more readable
|
|
19
|
+
'unicorn/no-array-reverse': 'off', // `Array.prototype.toReversed` is not yet supported by our TypeScript config
|
|
20
|
+
'unicorn/no-array-sort': 'off', // Disabling for the time being to avoid unnecessary diffs
|
|
21
|
+
'unicorn/no-hex-escape': 'off',
|
|
22
|
+
'unicorn/no-lonely-if': 'off', // https://github.com/PrairieLearn/PrairieLearn/pull/12546#discussion_r2252261293
|
|
23
|
+
'unicorn/no-null': 'off',
|
|
24
|
+
'unicorn/no-useless-undefined': 'off', // Explicit undefined is more readable than implicit undefined
|
|
25
|
+
'unicorn/prefer-code-point': 'off',
|
|
26
|
+
'unicorn/prefer-dom-node-dataset': 'off', // https://github.com/PrairieLearn/PrairieLearn/pull/12546#discussion_r2261095992
|
|
27
|
+
'unicorn/prefer-export-from': 'off', // https://github.com/PrairieLearn/PrairieLearn/pull/12546#discussion_r2252265000
|
|
28
|
+
'unicorn/prefer-string-raw': 'off', // We don't use `String.raw` in our codebase
|
|
29
|
+
'unicorn/prefer-ternary': 'off', // if/else can be more readable than a ternary
|
|
30
|
+
'unicorn/prefer-top-level-await': 'off', // we use this on a lot of pages
|
|
31
|
+
'unicorn/prefer-type-error': 'off',
|
|
32
|
+
'unicorn/prevent-abbreviations': 'off',
|
|
33
|
+
// These rules have many violations. Decisions about enabling the rules have been deferred.
|
|
34
|
+
'unicorn/catch-error-name': 'off', // 200+ violations
|
|
35
|
+
'unicorn/no-array-for-each': 'off', // 300+ violations
|
|
36
|
+
'unicorn/no-await-expression-member': 'off', // 400+ violations
|
|
37
|
+
'unicorn/no-negated-condition': 'off', // 150+ violations
|
|
38
|
+
'unicorn/prefer-global-this': 'off', // 150+ violations
|
|
39
|
+
'unicorn/prefer-node-protocol': 'off', // 100+ violations
|
|
40
|
+
'unicorn/switch-case-braces': 'off', // 200+ violations
|
|
41
|
+
// TODO: investigate, < 100 violations
|
|
42
|
+
'unicorn/consistent-assert': 'off',
|
|
43
|
+
'unicorn/consistent-function-scoping': 'off',
|
|
44
|
+
'unicorn/escape-case': 'off',
|
|
45
|
+
'unicorn/import-style': 'off',
|
|
46
|
+
'unicorn/numeric-separators-style': 'off',
|
|
47
|
+
'unicorn/prefer-query-selector': 'off',
|
|
48
|
+
'unicorn/prefer-spread': 'off',
|
|
49
|
+
'unicorn/prefer-switch': 'off',
|
|
50
|
+
'unicorn/text-encoding-identifier-case': 'off',
|
|
51
|
+
// TODO: investigated and manual fixes are required
|
|
52
|
+
'unicorn/no-object-as-default-parameter': 'off',
|
|
53
|
+
'unicorn/prefer-add-event-listener': 'off',
|
|
54
|
+
'unicorn/prefer-dom-node-text-content': 'off',
|
|
55
|
+
'unicorn/prefer-event-target': 'off',
|
|
56
|
+
// False positives
|
|
57
|
+
'unicorn/error-message': 'off',
|
|
58
|
+
'unicorn/prefer-at': 'off', // https://github.com/microsoft/TypeScript/issues/47660#issuecomment-3146907649
|
|
59
|
+
'unicorn/throw-new-error': 'off',
|
|
60
|
+
// Duplicated from other lint rules
|
|
61
|
+
'unicorn/no-static-only-class': 'off',
|
|
62
|
+
'unicorn/no-this-assignment': 'off',
|
|
63
|
+
'unicorn/prefer-module': 'off',
|
|
64
|
+
// https://github.com/PrairieLearn/PrairieLearn/pull/12545/files#r2252069292
|
|
65
|
+
'unicorn/no-for-loop': 'off',
|
|
66
|
+
// Conflicts with prettier
|
|
67
|
+
'unicorn/no-nested-ternary': 'off',
|
|
68
|
+
'unicorn/number-literal-case': 'off',
|
|
69
|
+
'unicorn/template-indent': 'off',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=unicorn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unicorn.js","sourceRoot":"","sources":["../../src/configs/unicorn.ts"],"names":[],"mappings":"AACA,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAExD;;GAEG;AACH,MAAM,UAAU,aAAa,GAAoC;IAC/D,OAAO;QACL;YACE,OAAO,EAAE;gBACP,OAAO,EAAE,mBAAmB;aAC7B;YAED,KAAK,EAAE;gBACL,GAAG,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;gBAEhD,wDAAwD;gBACxD,uBAAuB,EAAE,KAAK,EAAE,iDAAiD;gBACjF,qCAAqC,EAAE,KAAK,EAAE,mCAAmC;gBACjF,qCAAqC,EAAE,KAAK;gBAC5C,uCAAuC,EAAE,KAAK;gBAC9C,yBAAyB,EAAE,KAAK,EAAE,8CAA8C;gBAChF,0BAA0B,EAAE,KAAK,EAAE,6EAA6E;gBAChH,uBAAuB,EAAE,KAAK,EAAE,0DAA0D;gBAC1F,uBAAuB,EAAE,KAAK;gBAC9B,sBAAsB,EAAE,KAAK,EAAE,iFAAiF;gBAChH,iBAAiB,EAAE,KAAK;gBACxB,8BAA8B,EAAE,KAAK,EAAE,8DAA8D;gBACrG,2BAA2B,EAAE,KAAK;gBAClC,iCAAiC,EAAE,KAAK,EAAE,iFAAiF;gBAC3H,4BAA4B,EAAE,KAAK,EAAE,iFAAiF;gBACtH,2BAA2B,EAAE,KAAK,EAAE,4CAA4C;gBAChF,wBAAwB,EAAE,KAAK,EAAE,8CAA8C;gBAC/E,gCAAgC,EAAE,KAAK,EAAE,gCAAgC;gBACzE,2BAA2B,EAAE,KAAK;gBAClC,+BAA+B,EAAE,KAAK;gBAEtC,2FAA2F;gBAC3F,0BAA0B,EAAE,KAAK,EAAE,kBAAkB;gBACrD,2BAA2B,EAAE,KAAK,EAAE,kBAAkB;gBACtD,oCAAoC,EAAE,KAAK,EAAE,kBAAkB;gBAC/D,8BAA8B,EAAE,KAAK,EAAE,kBAAkB;gBACzD,4BAA4B,EAAE,KAAK,EAAE,kBAAkB;gBACvD,8BAA8B,EAAE,KAAK,EAAE,kBAAkB;gBACzD,4BAA4B,EAAE,KAAK,EAAE,kBAAkB;gBAEvD,sCAAsC;gBACtC,2BAA2B,EAAE,KAAK;gBAClC,qCAAqC,EAAE,KAAK;gBAC5C,qBAAqB,EAAE,KAAK;gBAC5B,sBAAsB,EAAE,KAAK;gBAC7B,kCAAkC,EAAE,KAAK;gBACzC,+BAA+B,EAAE,KAAK;gBACtC,uBAAuB,EAAE,KAAK;gBAC9B,uBAAuB,EAAE,KAAK;gBAC9B,uCAAuC,EAAE,KAAK;gBAE9C,mDAAmD;gBACnD,wCAAwC,EAAE,KAAK;gBAC/C,mCAAmC,EAAE,KAAK;gBAC1C,sCAAsC,EAAE,KAAK;gBAC7C,6BAA6B,EAAE,KAAK;gBAEpC,kBAAkB;gBAClB,uBAAuB,EAAE,KAAK;gBAC9B,mBAAmB,EAAE,KAAK,EAAE,+EAA+E;gBAC3G,yBAAyB,EAAE,KAAK;gBAEhC,mCAAmC;gBACnC,8BAA8B,EAAE,KAAK;gBACrC,4BAA4B,EAAE,KAAK;gBACnC,uBAAuB,EAAE,KAAK;gBAE9B,4EAA4E;gBAC5E,qBAAqB,EAAE,KAAK;gBAE5B,0BAA0B;gBAC1B,2BAA2B,EAAE,KAAK;gBAClC,6BAA6B,EAAE,KAAK;gBACpC,yBAAyB,EAAE,KAAK;aACjC;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport eslintPluginUnicorn from 'eslint-plugin-unicorn';\n\n/**\n * Unicorn plugin rules with PrairieLearn-specific overrides.\n */\nexport function unicornConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n unicorn: eslintPluginUnicorn,\n },\n\n rules: {\n ...eslintPluginUnicorn.configs.recommended.rules,\n\n // These rules don't align with our own style guidelines\n 'unicorn/filename-case': 'off', // We don't enforce specific styles for filenames\n 'unicorn/no-anonymous-default-export': 'off', // We use this for all of our pages\n 'unicorn/no-array-callback-reference': 'off',\n 'unicorn/no-array-method-this-argument': 'off',\n 'unicorn/no-array-reduce': 'off', // Sometimes, an array reduce is more readable\n 'unicorn/no-array-reverse': 'off', // `Array.prototype.toReversed` is not yet supported by our TypeScript config\n 'unicorn/no-array-sort': 'off', // Disabling for the time being to avoid unnecessary diffs\n 'unicorn/no-hex-escape': 'off',\n 'unicorn/no-lonely-if': 'off', // https://github.com/PrairieLearn/PrairieLearn/pull/12546#discussion_r2252261293\n 'unicorn/no-null': 'off',\n 'unicorn/no-useless-undefined': 'off', // Explicit undefined is more readable than implicit undefined\n 'unicorn/prefer-code-point': 'off',\n 'unicorn/prefer-dom-node-dataset': 'off', // https://github.com/PrairieLearn/PrairieLearn/pull/12546#discussion_r2261095992\n 'unicorn/prefer-export-from': 'off', // https://github.com/PrairieLearn/PrairieLearn/pull/12546#discussion_r2252265000\n 'unicorn/prefer-string-raw': 'off', // We don't use `String.raw` in our codebase\n 'unicorn/prefer-ternary': 'off', // if/else can be more readable than a ternary\n 'unicorn/prefer-top-level-await': 'off', // we use this on a lot of pages\n 'unicorn/prefer-type-error': 'off',\n 'unicorn/prevent-abbreviations': 'off',\n\n // These rules have many violations. Decisions about enabling the rules have been deferred.\n 'unicorn/catch-error-name': 'off', // 200+ violations\n 'unicorn/no-array-for-each': 'off', // 300+ violations\n 'unicorn/no-await-expression-member': 'off', // 400+ violations\n 'unicorn/no-negated-condition': 'off', // 150+ violations\n 'unicorn/prefer-global-this': 'off', // 150+ violations\n 'unicorn/prefer-node-protocol': 'off', // 100+ violations\n 'unicorn/switch-case-braces': 'off', // 200+ violations\n\n // TODO: investigate, < 100 violations\n 'unicorn/consistent-assert': 'off',\n 'unicorn/consistent-function-scoping': 'off',\n 'unicorn/escape-case': 'off',\n 'unicorn/import-style': 'off',\n 'unicorn/numeric-separators-style': 'off',\n 'unicorn/prefer-query-selector': 'off',\n 'unicorn/prefer-spread': 'off',\n 'unicorn/prefer-switch': 'off',\n 'unicorn/text-encoding-identifier-case': 'off',\n\n // TODO: investigated and manual fixes are required\n 'unicorn/no-object-as-default-parameter': 'off',\n 'unicorn/prefer-add-event-listener': 'off',\n 'unicorn/prefer-dom-node-text-content': 'off',\n 'unicorn/prefer-event-target': 'off',\n\n // False positives\n 'unicorn/error-message': 'off',\n 'unicorn/prefer-at': 'off', // https://github.com/microsoft/TypeScript/issues/47660#issuecomment-3146907649\n 'unicorn/throw-new-error': 'off',\n\n // Duplicated from other lint rules\n 'unicorn/no-static-only-class': 'off',\n 'unicorn/no-this-assignment': 'off',\n 'unicorn/prefer-module': 'off',\n\n // https://github.com/PrairieLearn/PrairieLearn/pull/12545/files#r2252069292\n 'unicorn/no-for-loop': 'off',\n\n // Conflicts with prettier\n 'unicorn/no-nested-ternary': 'off',\n 'unicorn/number-literal-case': 'off',\n 'unicorn/template-indent': 'off',\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../src/configs/vitest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;GAEG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAwB9D","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport vitest from '@vitest/eslint-plugin';\n\n/**\n * Vitest test framework rules.\n */\nexport function vitestConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n vitest,\n },\n\n rules: {\n // Use the recommended rules for vitest\n ...vitest.configs.recommended.rules,\n\n // We are disabling the test for a reason.\n 'vitest/no-disabled-tests': 'off',\n\n // This gives a lot of false positives; we sometimes author tests that\n // have the assertion in a helper function. We could refactor them in\n // the future, but for now we'll disable this rule.\n 'vitest/expect-expect': 'off',\n\n // We violate this rule in a lot of places. We'll turn it off for now.\n 'vitest/no-identical-title': 'off',\n },\n },\n ];\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import vitest from '@vitest/eslint-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Vitest test framework rules.
|
|
4
|
+
*/
|
|
5
|
+
export function vitestConfig() {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
plugins: {
|
|
9
|
+
vitest,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
// Use the recommended rules for vitest
|
|
13
|
+
...vitest.configs.recommended.rules,
|
|
14
|
+
// We are disabling the test for a reason.
|
|
15
|
+
'vitest/no-disabled-tests': 'off',
|
|
16
|
+
// This gives a lot of false positives; we sometimes author tests that
|
|
17
|
+
// have the assertion in a helper function. We could refactor them in
|
|
18
|
+
// the future, but for now we'll disable this rule.
|
|
19
|
+
'vitest/expect-expect': 'off',
|
|
20
|
+
// We violate this rule in a lot of places. We'll turn it off for now.
|
|
21
|
+
'vitest/no-identical-title': 'off',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=vitest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.js","sourceRoot":"","sources":["../../src/configs/vitest.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,YAAY,GAAoC;IAC9D,OAAO;QACL;YACE,OAAO,EAAE;gBACP,MAAM;aACP;YAED,KAAK,EAAE;gBACL,uCAAuC;gBACvC,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;gBAEnC,0CAA0C;gBAC1C,0BAA0B,EAAE,KAAK;gBAEjC,sEAAsE;gBACtE,qEAAqE;gBACrE,mDAAmD;gBACnD,sBAAsB,EAAE,KAAK;gBAE7B,sEAAsE;gBACtE,2BAA2B,EAAE,KAAK;aACnC;SACF;KACF,CAAC;AAAA,CACH","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport vitest from '@vitest/eslint-plugin';\n\n/**\n * Vitest test framework rules.\n */\nexport function vitestConfig(): TSESLint.FlatConfig.ConfigArray {\n return [\n {\n plugins: {\n vitest,\n },\n\n rules: {\n // Use the recommended rules for vitest\n ...vitest.configs.recommended.rules,\n\n // We are disabling the test for a reason.\n 'vitest/no-disabled-tests': 'off',\n\n // This gives a lot of false positives; we sometimes author tests that\n // have the assertion in a helper function. We could refactor them in\n // the future, but for now we'll disable this rule.\n 'vitest/expect-expect': 'off',\n\n // We violate this rule in a lot of places. We'll turn it off for now.\n 'vitest/no-identical-title': 'off',\n },\n },\n ];\n}\n"]}
|