@prairielearn/eslint-config 3.1.3 → 3.1.4

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,5 +1,11 @@
1
1
  # @prairielearn/eslint-config
2
2
 
3
+ ## 3.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - e2ed7cd: Apply additional eslint unicorn rules
8
+
3
9
  ## 3.1.3
4
10
 
5
11
  ### Patch Changes
@@ -1 +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,CA4K/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/prefer-unicode-code-point-escapes': '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/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/name-replacements': 'off',\n\n // These rules enforce conventions that we don't want to adopt.\n 'unicorn/consistent-boolean-name': 'off', // Boolean prefixes are too restrictive\n 'unicorn/consistent-class-member-order': 'off', // Existing class organization is readable\n 'unicorn/consistent-compound-words': 'off', // Would create unnecessary API naming churn\n 'unicorn/consistent-conditional-object-spread': 'off', // Both forms are readable\n 'unicorn/max-nested-calls': 'off', // An arbitrary nesting limit does not measure readability\n 'unicorn/no-break-in-nested-loop': 'off', // Extracting loops into functions is often less clear\n 'unicorn/no-computed-property-existence-check': 'off', // Dynamic property checks are valid\n 'unicorn/no-constant-zero-expression': 'off', // Explicit zero terms can document formulas and fixtures\n 'unicorn/no-declarations-before-early-exit': 'off', // Declaration placement is contextual\n 'unicorn/no-global-object-property-assignment': 'off', // Browser entry points intentionally expose globals\n 'unicorn/no-non-function-verb-prefix': 'off', // Verb prefixes are valid for values such as URLs and modals\n 'unicorn/no-this-outside-of-class': 'off', // We use function receivers and legacy callback APIs\n 'unicorn/no-top-level-assignment-in-function': 'off', // Modules intentionally maintain process state\n 'unicorn/no-top-level-side-effects': 'off', // Entry points and registration modules require side effects\n 'unicorn/no-unreadable-array-destructuring': 'off', // Property swaps are a readable destructuring use\n 'unicorn/no-unreadable-for-of-expression': 'off', // Temporary iterable variables are not always clearer\n 'unicorn/no-useless-else': 'off', // An explicit else can make control flow clearer\n 'unicorn/prefer-await': 'off', // Promise chains are sometimes clearer than try/catch\n 'unicorn/prefer-block-statement-over-iife': 'off', // IIFEs isolate legacy browser scripts\n 'unicorn/prefer-boolean-return': 'off', // Explicit branches can be clearer\n 'unicorn/prefer-continue': 'off', // Loop structure is contextual\n 'unicorn/prefer-early-return': 'off', // Guard clauses are not always clearer\n 'unicorn/prefer-else-if': 'off', // Separate conditions can better communicate intent\n 'unicorn/prefer-https': 'off', // HTTP is valid for local and test URLs\n 'unicorn/prefer-location-assign': 'off', // Assigning location.href is an established browser idiom\n 'unicorn/prefer-logical-operator-over-ternary': 'off', // Ternaries can make fallback behavior explicit\n 'unicorn/prefer-math-constants': 'off', // Approximate values are intentional in fixtures and examples\n 'unicorn/prefer-minimal-ternary': 'off', // The transformed expression is not always easier to read\n 'unicorn/prefer-number-coercion': 'off', // Number() differs from parseInt() and parseFloat()\n 'unicorn/prefer-number-is-safe-integer': 'off', // This changes the accepted numeric range\n 'unicorn/prefer-private-class-fields': 'off', // Underscore fields can be part of an external contract\n 'unicorn/prefer-queue-microtask': 'off', // queueMicrotask() and process.nextTick() have different ordering\n 'unicorn/prefer-split-limit': 'off', // Adding a limit is not clearer for most destructuring\n 'unicorn/prefer-then-catch': 'off', // Both Promise rejection styles are valid\n 'unicorn/single-line-block-comment-style': 'off', // Existing license and generated comments use both styles\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-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/prefer-simple-condition-first': 'off', // 100+ violations\n 'unicorn/switch-case-braces': 'off', // 200+ violations\n\n // These rules look valuable, but enabling them requires a focused manual migration.\n 'unicorn/better-dom-traversing': 'off', // 24 violations\n 'unicorn/isolated-functions': 'off', // 41 violations, including Playwright evaluation callbacks\n 'unicorn/no-array-sort-for-min-max': 'off', // 1 violation; empty-array behavior needs care\n 'unicorn/no-duplicate-loops': 'off', // 1 violation; requires an allocation/readability tradeoff\n 'unicorn/no-return-array-push': 'off', // 17 violations\n 'unicorn/no-undeclared-class-members': 'off', // 71 violations in a legacy browser class\n 'unicorn/no-unsafe-string-replacement': 'off', // 15 violations; replacements need semantic review\n 'unicorn/prefer-observer-apis': 'off', // 1 violation; requires an interaction behavior change\n 'unicorn/prefer-scoped-selector': 'off', // 12 violations\n 'unicorn/require-array-sort-compare': 'off', // 54 violations; string sorts need individual review\n\n // These rules can be considered in focused autofix or cleanup PRs.\n 'unicorn/logical-assignment-operators': 'off', // 40 violations\n 'unicorn/no-array-from-fill': 'off', // 1 violation\n 'unicorn/no-negated-array-predicate': 'off', // 26 violations\n 'unicorn/no-subtraction-comparison': 'off', // 1 violation\n 'unicorn/no-unnecessary-boolean-comparison': 'off', // 13 violations\n 'unicorn/no-unnecessary-fetch-options': 'off', // 1 violation\n 'unicorn/no-unnecessary-nested-ternary': 'off', // 3 violations\n 'unicorn/no-unnecessary-splice': 'off', // 5 violations\n 'unicorn/no-useless-coercion': 'off', // 43 violations\n 'unicorn/no-useless-concat': 'off', // 3 violations\n 'unicorn/no-useless-continue': 'off', // 2 violations\n 'unicorn/no-useless-template-literals': 'off', // 32 violations\n 'unicorn/operator-assignment': 'off', // 10 violations\n 'unicorn/prefer-add-event-listener-options': 'off', // 2 violations\n 'unicorn/prefer-array-from-map': 'off', // 23 violations\n 'unicorn/prefer-array-iterable-methods': 'off', // 1 violation\n 'unicorn/prefer-direct-iteration': 'off', // 15 violations\n 'unicorn/prefer-hoisting-branch-code': 'off', // 7 violations\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off', // 10 violations\n 'unicorn/prefer-math-abs': 'off', // 1 violation\n 'unicorn/prefer-object-iterable-methods': 'off', // 19 violations\n 'unicorn/prefer-simple-sort-comparator': 'off', // 1 violation\n 'unicorn/prefer-simplified-conditions': 'off', // 3 violations\n 'unicorn/prefer-string-repeat': 'off', // 16 violations\n 'unicorn/prefer-type-literal-last': 'off', // 1 violation\n 'unicorn/prefer-unary-minus': 'off', // 2 violations\n 'unicorn/prefer-url-href': 'off', // 5 violations\n\n // These rules require confirming browser and runtime support before enabling them.\n 'unicorn/prefer-array-from-async': 'off', // 5 violations\n 'unicorn/prefer-dom-node-html-methods': 'off', // 2 violations\n 'unicorn/prefer-dom-node-replace-children': 'off', // 3 violations\n 'unicorn/prefer-iterator-helpers': 'off', // 3 violations\n 'unicorn/prefer-iterator-to-array': 'off', // 34 violations\n 'unicorn/prefer-iterator-to-array-at-end': 'off', // 5 violations\n 'unicorn/prefer-promise-with-resolvers': 'off', // 5 violations\n 'unicorn/prefer-set-methods': 'off', // 5 violations\n 'unicorn/prefer-toggle-attribute': 'off', // 2 violations\n\n // False positives for intentional source text or module structure.\n 'unicorn/no-exports-in-scripts': 'off', // The server entry point is an ES module\n 'unicorn/no-incorrect-template-string-interpolation': 'off', // We test and document literal ${...} text\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-array-find': ['error', { checkFromLast: false }], // findLast is unavailable in our target lib\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"]}
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,CA4J/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/prefer-unicode-code-point-escapes': '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/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/name-replacements': 'off',\n\n // These rules enforce conventions that we don't want to adopt.\n 'unicorn/consistent-boolean-name': 'off', // Boolean prefixes are too restrictive\n 'unicorn/consistent-class-member-order': 'off', // Existing class organization is readable\n 'unicorn/consistent-compound-words': 'off', // Would create unnecessary API naming churn\n 'unicorn/consistent-conditional-object-spread': 'off', // Both forms are readable\n 'unicorn/max-nested-calls': 'off', // An arbitrary nesting limit does not measure readability\n 'unicorn/no-break-in-nested-loop': 'off', // Extracting loops into functions is often less clear\n 'unicorn/no-computed-property-existence-check': 'off', // Dynamic property checks are valid\n 'unicorn/no-constant-zero-expression': 'off', // Explicit zero terms can document formulas and fixtures\n 'unicorn/no-declarations-before-early-exit': 'off', // Declaration placement is contextual\n 'unicorn/no-global-object-property-assignment': 'off', // Browser entry points intentionally expose globals\n 'unicorn/no-non-function-verb-prefix': 'off', // Verb prefixes are valid for values such as URLs and modals\n 'unicorn/no-this-outside-of-class': 'off', // We use function receivers and legacy callback APIs\n 'unicorn/no-top-level-assignment-in-function': 'off', // Modules intentionally maintain process state\n 'unicorn/no-top-level-side-effects': 'off', // Entry points and registration modules require side effects\n 'unicorn/no-unreadable-array-destructuring': 'off', // Property swaps are a readable destructuring use\n 'unicorn/no-unreadable-for-of-expression': 'off', // Temporary iterable variables are not always clearer\n 'unicorn/no-useless-else': 'off', // An explicit else can make control flow clearer\n 'unicorn/prefer-await': 'off', // Promise chains are sometimes clearer than try/catch\n 'unicorn/prefer-block-statement-over-iife': 'off', // IIFEs isolate legacy browser scripts\n 'unicorn/prefer-boolean-return': 'off', // Explicit branches can be clearer\n 'unicorn/prefer-continue': 'off', // Loop structure is contextual\n 'unicorn/prefer-early-return': 'off', // Guard clauses are not always clearer\n 'unicorn/prefer-else-if': 'off', // Separate conditions can better communicate intent\n 'unicorn/prefer-https': 'off', // HTTP is valid for local and test URLs\n 'unicorn/prefer-location-assign': 'off', // Assigning location.href is an established browser idiom\n 'unicorn/prefer-logical-operator-over-ternary': 'off', // Ternaries can make fallback behavior explicit\n 'unicorn/prefer-math-constants': 'off', // Approximate values are intentional in fixtures and examples\n 'unicorn/prefer-minimal-ternary': 'off', // The transformed expression is not always easier to read\n 'unicorn/prefer-number-coercion': 'off', // Number() differs from parseInt() and parseFloat()\n 'unicorn/prefer-number-is-safe-integer': 'off', // This changes the accepted numeric range\n 'unicorn/prefer-private-class-fields': 'off', // Underscore fields can be part of an external contract\n 'unicorn/prefer-queue-microtask': 'off', // queueMicrotask() and process.nextTick() have different ordering\n 'unicorn/prefer-split-limit': 'off', // Adding a limit is not clearer for most destructuring\n 'unicorn/prefer-then-catch': 'off', // Both Promise rejection styles are valid\n 'unicorn/single-line-block-comment-style': 'off', // Existing license and generated comments use both styles\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-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/prefer-simple-condition-first': 'off', // 100+ violations\n 'unicorn/switch-case-braces': 'off', // 200+ violations\n\n // These rules look valuable, but enabling them requires a focused manual migration.\n 'unicorn/better-dom-traversing': 'off', // 24 violations\n 'unicorn/isolated-functions': 'off', // 41 violations, including Playwright evaluation callbacks\n 'unicorn/no-array-sort-for-min-max': 'off', // 1 violation; empty-array behavior needs care\n 'unicorn/no-duplicate-loops': 'off', // 1 violation; requires an allocation/readability tradeoff\n 'unicorn/no-return-array-push': 'off', // 17 violations\n 'unicorn/no-undeclared-class-members': 'off', // 71 violations in a legacy browser class\n 'unicorn/no-unsafe-string-replacement': 'off', // 15 violations; replacements need semantic review\n 'unicorn/prefer-observer-apis': 'off', // 1 violation; requires an interaction behavior change\n 'unicorn/prefer-scoped-selector': 'off', // 12 violations\n 'unicorn/require-array-sort-compare': 'off', // 54 violations; string sorts need individual review\n\n // These rules can be considered in focused autofix or cleanup PRs.\n 'unicorn/logical-assignment-operators': 'off', // 40 violations\n 'unicorn/no-negated-array-predicate': 'off', // 26 violations\n 'unicorn/no-unnecessary-boolean-comparison': 'off', // 13 violations\n 'unicorn/no-useless-coercion': 'off', // 43 violations\n 'unicorn/no-useless-template-literals': 'off', // 32 violations\n 'unicorn/operator-assignment': 'off', // 10 violations\n 'unicorn/prefer-array-from-map': 'off', // 23 violations\n 'unicorn/prefer-direct-iteration': 'off', // 15 violations\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off', // 10 violations\n 'unicorn/prefer-object-iterable-methods': 'off', // 19 violations\n 'unicorn/prefer-string-repeat': 'off', // 16 violations\n\n // These rules require confirming browser and runtime support before enabling them.\n 'unicorn/prefer-array-from-async': 'off', // 5 violations\n 'unicorn/prefer-dom-node-html-methods': 'off', // 2 violations\n 'unicorn/prefer-dom-node-replace-children': 'off', // 3 violations\n 'unicorn/prefer-iterator-helpers': 'off', // 3 violations\n 'unicorn/prefer-iterator-to-array': 'off', // 34 violations\n 'unicorn/prefer-iterator-to-array-at-end': 'off', // 5 violations\n 'unicorn/prefer-promise-with-resolvers': 'off', // 5 violations\n 'unicorn/prefer-set-methods': 'off', // 5 violations\n 'unicorn/prefer-toggle-attribute': 'off', // 2 violations\n\n // False positives for intentional source text or module structure.\n 'unicorn/no-exports-in-scripts': 'off', // The server entry point is an ES module\n 'unicorn/no-incorrect-template-string-interpolation': 'off', // We test and document literal ${...} text\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-array-find': ['error', { checkFromLast: false }], // findLast is unavailable in our target lib\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"]}
@@ -88,32 +88,16 @@ export function unicornConfig() {
88
88
  'unicorn/require-array-sort-compare': 'off', // 54 violations; string sorts need individual review
89
89
  // These rules can be considered in focused autofix or cleanup PRs.
90
90
  'unicorn/logical-assignment-operators': 'off', // 40 violations
91
- 'unicorn/no-array-from-fill': 'off', // 1 violation
92
91
  'unicorn/no-negated-array-predicate': 'off', // 26 violations
93
- 'unicorn/no-subtraction-comparison': 'off', // 1 violation
94
92
  'unicorn/no-unnecessary-boolean-comparison': 'off', // 13 violations
95
- 'unicorn/no-unnecessary-fetch-options': 'off', // 1 violation
96
- 'unicorn/no-unnecessary-nested-ternary': 'off', // 3 violations
97
- 'unicorn/no-unnecessary-splice': 'off', // 5 violations
98
93
  'unicorn/no-useless-coercion': 'off', // 43 violations
99
- 'unicorn/no-useless-concat': 'off', // 3 violations
100
- 'unicorn/no-useless-continue': 'off', // 2 violations
101
94
  'unicorn/no-useless-template-literals': 'off', // 32 violations
102
95
  'unicorn/operator-assignment': 'off', // 10 violations
103
- 'unicorn/prefer-add-event-listener-options': 'off', // 2 violations
104
96
  'unicorn/prefer-array-from-map': 'off', // 23 violations
105
- 'unicorn/prefer-array-iterable-methods': 'off', // 1 violation
106
97
  'unicorn/prefer-direct-iteration': 'off', // 15 violations
107
- 'unicorn/prefer-hoisting-branch-code': 'off', // 7 violations
108
98
  'unicorn/prefer-includes-over-repeated-comparisons': 'off', // 10 violations
109
- 'unicorn/prefer-math-abs': 'off', // 1 violation
110
99
  'unicorn/prefer-object-iterable-methods': 'off', // 19 violations
111
- 'unicorn/prefer-simple-sort-comparator': 'off', // 1 violation
112
- 'unicorn/prefer-simplified-conditions': 'off', // 3 violations
113
100
  'unicorn/prefer-string-repeat': 'off', // 16 violations
114
- 'unicorn/prefer-type-literal-last': 'off', // 1 violation
115
- 'unicorn/prefer-unary-minus': 'off', // 2 violations
116
- 'unicorn/prefer-url-href': 'off', // 5 violations
117
101
  // These rules require confirming browser and runtime support before enabling them.
118
102
  'unicorn/prefer-array-from-async': 'off', // 5 violations
119
103
  'unicorn/prefer-dom-node-html-methods': 'off', // 2 violations
@@ -1 +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;IAC3B,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;gBACj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sC,EAAE,KAAK;gBAC7C,6BAA6B,EAAE,KAAK;gBAEpC,kBAAkB;gBAClB,uBAAuB,EAAE,KAAK;gBAC9B,2BAA2B,EAAE,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,4CAA4C;gBAC9G,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;AACJ,CAAC","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/prefer-unicode-code-point-escapes': '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/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/name-replacements': 'off',\n\n // These rules enforce conventions that we don't want to adopt.\n 'unicorn/consistent-boolean-name': 'off', // Boolean prefixes are too restrictive\n 'unicorn/consistent-class-member-order': 'off', // Existing class organization is readable\n 'unicorn/consistent-compound-words': 'off', // Would create unnecessary API naming churn\n 'unicorn/consistent-conditional-object-spread': 'off', // Both forms are readable\n 'unicorn/max-nested-calls': 'off', // An arbitrary nesting limit does not measure readability\n 'unicorn/no-break-in-nested-loop': 'off', // Extracting loops into functions is often less clear\n 'unicorn/no-computed-property-existence-check': 'off', // Dynamic property checks are valid\n 'unicorn/no-constant-zero-expression': 'off', // Explicit zero terms can document formulas and fixtures\n 'unicorn/no-declarations-before-early-exit': 'off', // Declaration placement is contextual\n 'unicorn/no-global-object-property-assignment': 'off', // Browser entry points intentionally expose globals\n 'unicorn/no-non-function-verb-prefix': 'off', // Verb prefixes are valid for values such as URLs and modals\n 'unicorn/no-this-outside-of-class': 'off', // We use function receivers and legacy callback APIs\n 'unicorn/no-top-level-assignment-in-function': 'off', // Modules intentionally maintain process state\n 'unicorn/no-top-level-side-effects': 'off', // Entry points and registration modules require side effects\n 'unicorn/no-unreadable-array-destructuring': 'off', // Property swaps are a readable destructuring use\n 'unicorn/no-unreadable-for-of-expression': 'off', // Temporary iterable variables are not always clearer\n 'unicorn/no-useless-else': 'off', // An explicit else can make control flow clearer\n 'unicorn/prefer-await': 'off', // Promise chains are sometimes clearer than try/catch\n 'unicorn/prefer-block-statement-over-iife': 'off', // IIFEs isolate legacy browser scripts\n 'unicorn/prefer-boolean-return': 'off', // Explicit branches can be clearer\n 'unicorn/prefer-continue': 'off', // Loop structure is contextual\n 'unicorn/prefer-early-return': 'off', // Guard clauses are not always clearer\n 'unicorn/prefer-else-if': 'off', // Separate conditions can better communicate intent\n 'unicorn/prefer-https': 'off', // HTTP is valid for local and test URLs\n 'unicorn/prefer-location-assign': 'off', // Assigning location.href is an established browser idiom\n 'unicorn/prefer-logical-operator-over-ternary': 'off', // Ternaries can make fallback behavior explicit\n 'unicorn/prefer-math-constants': 'off', // Approximate values are intentional in fixtures and examples\n 'unicorn/prefer-minimal-ternary': 'off', // The transformed expression is not always easier to read\n 'unicorn/prefer-number-coercion': 'off', // Number() differs from parseInt() and parseFloat()\n 'unicorn/prefer-number-is-safe-integer': 'off', // This changes the accepted numeric range\n 'unicorn/prefer-private-class-fields': 'off', // Underscore fields can be part of an external contract\n 'unicorn/prefer-queue-microtask': 'off', // queueMicrotask() and process.nextTick() have different ordering\n 'unicorn/prefer-split-limit': 'off', // Adding a limit is not clearer for most destructuring\n 'unicorn/prefer-then-catch': 'off', // Both Promise rejection styles are valid\n 'unicorn/single-line-block-comment-style': 'off', // Existing license and generated comments use both styles\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-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/prefer-simple-condition-first': 'off', // 100+ violations\n 'unicorn/switch-case-braces': 'off', // 200+ violations\n\n // These rules look valuable, but enabling them requires a focused manual migration.\n 'unicorn/better-dom-traversing': 'off', // 24 violations\n 'unicorn/isolated-functions': 'off', // 41 violations, including Playwright evaluation callbacks\n 'unicorn/no-array-sort-for-min-max': 'off', // 1 violation; empty-array behavior needs care\n 'unicorn/no-duplicate-loops': 'off', // 1 violation; requires an allocation/readability tradeoff\n 'unicorn/no-return-array-push': 'off', // 17 violations\n 'unicorn/no-undeclared-class-members': 'off', // 71 violations in a legacy browser class\n 'unicorn/no-unsafe-string-replacement': 'off', // 15 violations; replacements need semantic review\n 'unicorn/prefer-observer-apis': 'off', // 1 violation; requires an interaction behavior change\n 'unicorn/prefer-scoped-selector': 'off', // 12 violations\n 'unicorn/require-array-sort-compare': 'off', // 54 violations; string sorts need individual review\n\n // These rules can be considered in focused autofix or cleanup PRs.\n 'unicorn/logical-assignment-operators': 'off', // 40 violations\n 'unicorn/no-array-from-fill': 'off', // 1 violation\n 'unicorn/no-negated-array-predicate': 'off', // 26 violations\n 'unicorn/no-subtraction-comparison': 'off', // 1 violation\n 'unicorn/no-unnecessary-boolean-comparison': 'off', // 13 violations\n 'unicorn/no-unnecessary-fetch-options': 'off', // 1 violation\n 'unicorn/no-unnecessary-nested-ternary': 'off', // 3 violations\n 'unicorn/no-unnecessary-splice': 'off', // 5 violations\n 'unicorn/no-useless-coercion': 'off', // 43 violations\n 'unicorn/no-useless-concat': 'off', // 3 violations\n 'unicorn/no-useless-continue': 'off', // 2 violations\n 'unicorn/no-useless-template-literals': 'off', // 32 violations\n 'unicorn/operator-assignment': 'off', // 10 violations\n 'unicorn/prefer-add-event-listener-options': 'off', // 2 violations\n 'unicorn/prefer-array-from-map': 'off', // 23 violations\n 'unicorn/prefer-array-iterable-methods': 'off', // 1 violation\n 'unicorn/prefer-direct-iteration': 'off', // 15 violations\n 'unicorn/prefer-hoisting-branch-code': 'off', // 7 violations\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off', // 10 violations\n 'unicorn/prefer-math-abs': 'off', // 1 violation\n 'unicorn/prefer-object-iterable-methods': 'off', // 19 violations\n 'unicorn/prefer-simple-sort-comparator': 'off', // 1 violation\n 'unicorn/prefer-simplified-conditions': 'off', // 3 violations\n 'unicorn/prefer-string-repeat': 'off', // 16 violations\n 'unicorn/prefer-type-literal-last': 'off', // 1 violation\n 'unicorn/prefer-unary-minus': 'off', // 2 violations\n 'unicorn/prefer-url-href': 'off', // 5 violations\n\n // These rules require confirming browser and runtime support before enabling them.\n 'unicorn/prefer-array-from-async': 'off', // 5 violations\n 'unicorn/prefer-dom-node-html-methods': 'off', // 2 violations\n 'unicorn/prefer-dom-node-replace-children': 'off', // 3 violations\n 'unicorn/prefer-iterator-helpers': 'off', // 3 violations\n 'unicorn/prefer-iterator-to-array': 'off', // 34 violations\n 'unicorn/prefer-iterator-to-array-at-end': 'off', // 5 violations\n 'unicorn/prefer-promise-with-resolvers': 'off', // 5 violations\n 'unicorn/prefer-set-methods': 'off', // 5 violations\n 'unicorn/prefer-toggle-attribute': 'off', // 2 violations\n\n // False positives for intentional source text or module structure.\n 'unicorn/no-exports-in-scripts': 'off', // The server entry point is an ES module\n 'unicorn/no-incorrect-template-string-interpolation': 'off', // We test and document literal ${...} text\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-array-find': ['error', { checkFromLast: false }], // findLast is unavailable in our target lib\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"]}
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;IAC3B,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,2CAA2C,EAAE,KAAK;gBAClD,sBAAsB,EAAE,KAAK,EAAE,iFAAiF;gBAChH,iBAAiB,EAAE,KAAK;gBACxB,8BAA8B,EAAE,KAAK,EAAE,8DAA8D;gBACrG,2BAA2B,EAAE,KAAK;gBAClC,0BAA0B,EAAE,KAAK,EAAE,iFAAiF;gBACpH,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,2BAA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kBAAkB;gBAClB,uBAAuB,EAAE,KAAK;gBAC9B,2BAA2B,EAAE,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,4CAA4C;gBAC9G,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;AACJ,CAAC","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/prefer-unicode-code-point-escapes': '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/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/name-replacements': 'off',\n\n // These rules enforce conventions that we don't want to adopt.\n 'unicorn/consistent-boolean-name': 'off', // Boolean prefixes are too restrictive\n 'unicorn/consistent-class-member-order': 'off', // Existing class organization is readable\n 'unicorn/consistent-compound-words': 'off', // Would create unnecessary API naming churn\n 'unicorn/consistent-conditional-object-spread': 'off', // Both forms are readable\n 'unicorn/max-nested-calls': 'off', // An arbitrary nesting limit does not measure readability\n 'unicorn/no-break-in-nested-loop': 'off', // Extracting loops into functions is often less clear\n 'unicorn/no-computed-property-existence-check': 'off', // Dynamic property checks are valid\n 'unicorn/no-constant-zero-expression': 'off', // Explicit zero terms can document formulas and fixtures\n 'unicorn/no-declarations-before-early-exit': 'off', // Declaration placement is contextual\n 'unicorn/no-global-object-property-assignment': 'off', // Browser entry points intentionally expose globals\n 'unicorn/no-non-function-verb-prefix': 'off', // Verb prefixes are valid for values such as URLs and modals\n 'unicorn/no-this-outside-of-class': 'off', // We use function receivers and legacy callback APIs\n 'unicorn/no-top-level-assignment-in-function': 'off', // Modules intentionally maintain process state\n 'unicorn/no-top-level-side-effects': 'off', // Entry points and registration modules require side effects\n 'unicorn/no-unreadable-array-destructuring': 'off', // Property swaps are a readable destructuring use\n 'unicorn/no-unreadable-for-of-expression': 'off', // Temporary iterable variables are not always clearer\n 'unicorn/no-useless-else': 'off', // An explicit else can make control flow clearer\n 'unicorn/prefer-await': 'off', // Promise chains are sometimes clearer than try/catch\n 'unicorn/prefer-block-statement-over-iife': 'off', // IIFEs isolate legacy browser scripts\n 'unicorn/prefer-boolean-return': 'off', // Explicit branches can be clearer\n 'unicorn/prefer-continue': 'off', // Loop structure is contextual\n 'unicorn/prefer-early-return': 'off', // Guard clauses are not always clearer\n 'unicorn/prefer-else-if': 'off', // Separate conditions can better communicate intent\n 'unicorn/prefer-https': 'off', // HTTP is valid for local and test URLs\n 'unicorn/prefer-location-assign': 'off', // Assigning location.href is an established browser idiom\n 'unicorn/prefer-logical-operator-over-ternary': 'off', // Ternaries can make fallback behavior explicit\n 'unicorn/prefer-math-constants': 'off', // Approximate values are intentional in fixtures and examples\n 'unicorn/prefer-minimal-ternary': 'off', // The transformed expression is not always easier to read\n 'unicorn/prefer-number-coercion': 'off', // Number() differs from parseInt() and parseFloat()\n 'unicorn/prefer-number-is-safe-integer': 'off', // This changes the accepted numeric range\n 'unicorn/prefer-private-class-fields': 'off', // Underscore fields can be part of an external contract\n 'unicorn/prefer-queue-microtask': 'off', // queueMicrotask() and process.nextTick() have different ordering\n 'unicorn/prefer-split-limit': 'off', // Adding a limit is not clearer for most destructuring\n 'unicorn/prefer-then-catch': 'off', // Both Promise rejection styles are valid\n 'unicorn/single-line-block-comment-style': 'off', // Existing license and generated comments use both styles\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-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/prefer-simple-condition-first': 'off', // 100+ violations\n 'unicorn/switch-case-braces': 'off', // 200+ violations\n\n // These rules look valuable, but enabling them requires a focused manual migration.\n 'unicorn/better-dom-traversing': 'off', // 24 violations\n 'unicorn/isolated-functions': 'off', // 41 violations, including Playwright evaluation callbacks\n 'unicorn/no-array-sort-for-min-max': 'off', // 1 violation; empty-array behavior needs care\n 'unicorn/no-duplicate-loops': 'off', // 1 violation; requires an allocation/readability tradeoff\n 'unicorn/no-return-array-push': 'off', // 17 violations\n 'unicorn/no-undeclared-class-members': 'off', // 71 violations in a legacy browser class\n 'unicorn/no-unsafe-string-replacement': 'off', // 15 violations; replacements need semantic review\n 'unicorn/prefer-observer-apis': 'off', // 1 violation; requires an interaction behavior change\n 'unicorn/prefer-scoped-selector': 'off', // 12 violations\n 'unicorn/require-array-sort-compare': 'off', // 54 violations; string sorts need individual review\n\n // These rules can be considered in focused autofix or cleanup PRs.\n 'unicorn/logical-assignment-operators': 'off', // 40 violations\n 'unicorn/no-negated-array-predicate': 'off', // 26 violations\n 'unicorn/no-unnecessary-boolean-comparison': 'off', // 13 violations\n 'unicorn/no-useless-coercion': 'off', // 43 violations\n 'unicorn/no-useless-template-literals': 'off', // 32 violations\n 'unicorn/operator-assignment': 'off', // 10 violations\n 'unicorn/prefer-array-from-map': 'off', // 23 violations\n 'unicorn/prefer-direct-iteration': 'off', // 15 violations\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off', // 10 violations\n 'unicorn/prefer-object-iterable-methods': 'off', // 19 violations\n 'unicorn/prefer-string-repeat': 'off', // 16 violations\n\n // These rules require confirming browser and runtime support before enabling them.\n 'unicorn/prefer-array-from-async': 'off', // 5 violations\n 'unicorn/prefer-dom-node-html-methods': 'off', // 2 violations\n 'unicorn/prefer-dom-node-replace-children': 'off', // 3 violations\n 'unicorn/prefer-iterator-helpers': 'off', // 3 violations\n 'unicorn/prefer-iterator-to-array': 'off', // 34 violations\n 'unicorn/prefer-iterator-to-array-at-end': 'off', // 5 violations\n 'unicorn/prefer-promise-with-resolvers': 'off', // 5 violations\n 'unicorn/prefer-set-methods': 'off', // 5 violations\n 'unicorn/prefer-toggle-attribute': 'off', // 2 violations\n\n // False positives for intentional source text or module structure.\n 'unicorn/no-exports-in-scripts': 'off', // The server entry point is an ES module\n 'unicorn/no-incorrect-template-string-interpolation': 'off', // We test and document literal ${...} text\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-array-find': ['error', { checkFromLast: false }], // findLast is unavailable in our target lib\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prairielearn/eslint-config",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  "eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
39
39
  "globals": "^17.9.0",
40
40
  "typescript-eslint": "^8.66.0",
41
- "@prairielearn/eslint-plugin": "^4.3.5"
41
+ "@prairielearn/eslint-plugin": "^4.3.6"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^24.13.3",
@@ -96,32 +96,16 @@ export function unicornConfig(): TSESLint.FlatConfig.ConfigArray {
96
96
 
97
97
  // These rules can be considered in focused autofix or cleanup PRs.
98
98
  'unicorn/logical-assignment-operators': 'off', // 40 violations
99
- 'unicorn/no-array-from-fill': 'off', // 1 violation
100
99
  'unicorn/no-negated-array-predicate': 'off', // 26 violations
101
- 'unicorn/no-subtraction-comparison': 'off', // 1 violation
102
100
  'unicorn/no-unnecessary-boolean-comparison': 'off', // 13 violations
103
- 'unicorn/no-unnecessary-fetch-options': 'off', // 1 violation
104
- 'unicorn/no-unnecessary-nested-ternary': 'off', // 3 violations
105
- 'unicorn/no-unnecessary-splice': 'off', // 5 violations
106
101
  'unicorn/no-useless-coercion': 'off', // 43 violations
107
- 'unicorn/no-useless-concat': 'off', // 3 violations
108
- 'unicorn/no-useless-continue': 'off', // 2 violations
109
102
  'unicorn/no-useless-template-literals': 'off', // 32 violations
110
103
  'unicorn/operator-assignment': 'off', // 10 violations
111
- 'unicorn/prefer-add-event-listener-options': 'off', // 2 violations
112
104
  'unicorn/prefer-array-from-map': 'off', // 23 violations
113
- 'unicorn/prefer-array-iterable-methods': 'off', // 1 violation
114
105
  'unicorn/prefer-direct-iteration': 'off', // 15 violations
115
- 'unicorn/prefer-hoisting-branch-code': 'off', // 7 violations
116
106
  'unicorn/prefer-includes-over-repeated-comparisons': 'off', // 10 violations
117
- 'unicorn/prefer-math-abs': 'off', // 1 violation
118
107
  'unicorn/prefer-object-iterable-methods': 'off', // 19 violations
119
- 'unicorn/prefer-simple-sort-comparator': 'off', // 1 violation
120
- 'unicorn/prefer-simplified-conditions': 'off', // 3 violations
121
108
  'unicorn/prefer-string-repeat': 'off', // 16 violations
122
- 'unicorn/prefer-type-literal-last': 'off', // 1 violation
123
- 'unicorn/prefer-unary-minus': 'off', // 2 violations
124
- 'unicorn/prefer-url-href': 'off', // 5 violations
125
109
 
126
110
  // These rules require confirming browser and runtime support before enabling them.
127
111
  'unicorn/prefer-array-from-async': 'off', // 5 violations