@prairielearn/eslint-config 3.0.1 → 3.0.2
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/CHANGELOG.md
CHANGED
|
@@ -1 +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;AAezD;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/configs/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAezD;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAmE7D","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\nconst disableConflictReactHooksConfig =\n eslintReact.configs['disable-conflict-eslint-plugin-react-hooks'];\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 // https://www.eslint-react.xyz/docs/migrating-from-eslint-plugin-react-hooks#migration-preset\n ...disableConflictReactHooksConfig.rules,\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 // This rule flags many legitimate effect-based synchronizations with\n // third-party libraries, DOM APIs, and form state.\n 'react-you-might-not-need-an-effect/no-event-handler': 'off',\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/use-state': 'off',\n // Forbid `target=\"_blank\"` without `rel=\"noreferrer\"` for security reasons.\n '@eslint-react/dom-no-unsafe-target-blank': 'error',\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"]}
|
package/dist/configs/react.js
CHANGED
|
@@ -22,6 +22,9 @@ export function reactConfig() {
|
|
|
22
22
|
...disableConflictReactHooksConfig.rules,
|
|
23
23
|
// react-you-might-not-need-an-effect rules as errors
|
|
24
24
|
...Object.fromEntries(Object.keys(reactYouMightNotNeedAnEffect.configs?.recommended?.rules ?? {}).map((ruleName) => [ruleName, 'error'])),
|
|
25
|
+
// This rule flags many legitimate effect-based synchronizations with
|
|
26
|
+
// third-party libraries, DOM APIs, and form state.
|
|
27
|
+
'react-you-might-not-need-an-effect/no-event-handler': 'off',
|
|
25
28
|
// eslint-react recommended rules as errors
|
|
26
29
|
...Object.fromEntries(Object.entries(eslintReactConfig.rules ?? {}).map(([ruleName, severity]) => [
|
|
27
30
|
ruleName,
|
|
@@ -1 +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,MAAM,+BAA+B,GACnC,WAAW,CAAC,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,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,8FAA8F;gBAC9F,GAAG,+BAA+B,CAAC,KAAK;gBAExC,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,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C,KAAK,CAAC,CAAC,CAAC,OAAO;iBACrC,CACF,CACF;gBACD,uEAAuE;gBACvE,2EAA2E;gBAC3E,yBAAyB,EAAE,KAAK;gBAChC,4EAA4E;gBAC5E,0CAA0C,EAAE,OAAO;gBAEnD,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;AACJ,CAAC","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\nconst disableConflictReactHooksConfig =\n eslintReact.configs['disable-conflict-eslint-plugin-react-hooks'];\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 // https://www.eslint-react.xyz/docs/migrating-from-eslint-plugin-react-hooks#migration-preset\n ...disableConflictReactHooksConfig.rules,\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 // This rule flags many legitimate effect-based synchronizations with\n // third-party libraries, DOM APIs, and form state.\n 'react-you-might-not-need-an-effect/no-event-handler': 'off',\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/use-state': 'off',\n // Forbid `target=\"_blank\"` without `rel=\"noreferrer\"` for security reasons.\n '@eslint-react/dom-no-unsafe-target-blank': 'error',\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prairielearn/eslint-config",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@eslint-react/eslint-plugin": "^5.7.2",
|
|
27
27
|
"@eslint/config-helpers": "^0.5.5",
|
|
28
28
|
"@eslint/js": "^10.0.1",
|
|
29
|
-
"@prairielearn/eslint-plugin": "^4.3.
|
|
29
|
+
"@prairielearn/eslint-plugin": "^4.3.1",
|
|
30
30
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
31
31
|
"@tanstack/eslint-plugin-query": "^5.100.9",
|
|
32
32
|
"@typescript-eslint/utils": "^8.59.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"eslint-plugin-no-floating-promise": "^2.0.0",
|
|
39
39
|
"eslint-plugin-perfectionist": "^5.9.0",
|
|
40
40
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
41
|
-
"eslint-plugin-react-you-might-not-need-an-effect": "^0.10.
|
|
41
|
+
"eslint-plugin-react-you-might-not-need-an-effect": "^0.10.2",
|
|
42
42
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
43
43
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
|
|
44
44
|
"globals": "^17.6.0",
|
package/src/configs/react.ts
CHANGED
|
@@ -37,6 +37,9 @@ export function reactConfig(): TSESLint.FlatConfig.ConfigArray {
|
|
|
37
37
|
(ruleName: string) => [ruleName, 'error'],
|
|
38
38
|
),
|
|
39
39
|
),
|
|
40
|
+
// This rule flags many legitimate effect-based synchronizations with
|
|
41
|
+
// third-party libraries, DOM APIs, and form state.
|
|
42
|
+
'react-you-might-not-need-an-effect/no-event-handler': 'off',
|
|
40
43
|
|
|
41
44
|
// eslint-react recommended rules as errors
|
|
42
45
|
...Object.fromEntries(
|