nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: tatethurston/nextjs-routes
Pull request #30 (2022-07-08 19:58:32)

update nonroutable list


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 019e87f..eac51ca 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
 - re-export types from `next/link` and `next/router`
 - remove prettier as a peer dependency
 - enable src/pages for windows users
+- routes are now generated for routes that start with `_`. `_app`, `_document`, `_error` and `middleware` are excluded.
 
 ## 0.0.16
 
diff --git a/src/utils.ts b/src/utils.ts
index a465c64..d7d08b3 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -1,7 +1,7 @@
 import { existsSync, readdirSync, statSync } from "fs";
 import { join, parse } from "path";
 
-const NEXTJS_NON_ROUTABLE_PREFIX = "_";
+const NEXTJS_NON_ROUTABLE = ["/_app", "/_document", "/_error", "/middleware"];
 const DYNAMIC_SEGMENT_RE = /\[(.*?)\]/g;
 
 export function getPagesDirectory(): string | undefined {
@@ -43,7 +43,7 @@ export function nextRoutes(files: string[], pagesDirectory: string): Route[] {
     .map((file) => file.replace(pagesDirectory, ""))
     .map((file) => file.replace(parse(file).ext, ""))
     .map(convertWindowsPathToUnix)
-    .filter((file) => !parse(file).name.startsWith(NEXTJS_NON_ROUTABLE_PREFIX));
+    .filter((file) => !NEXTJS_NON_ROUTABLE.includes(file));
 
   return filenames.map((filename) => {
     const segments = filename.match(DYNAMIC_SEGMENT_RE) ?? [];


Test patch:
diff --git a/src/__snapshots__/test.ts.snap b/src/__snapshots__/test.ts.snap
index 1bdb6d6..8146c0c 100644
--- a/src/__snapshots__/test.ts.snap
+++ b/src/__snapshots__/test.ts.snap
@@ -14,6 +14,7 @@ declare module \\"nextjs-routes\\" {
     | { pathname: \\"/[foo]/bar/[baz]\\"; query: Query<{ foo: string; baz: string }> }
     | { pathname: \\"/[foo]/bar/[baz]/foo/[bar]\\"; query: Query<{ foo: string; baz: string; bar: string }> }
     | { pathname: \\"/[foo]/baz\\"; query: Query<{ foo: string }> }
+    | { pathname: \\"/_debug\\"; query?: Query | undefined }
     | { pathname: \\"/_debug/health-check\\"; query?: Query | undefined }
     | { pathname: \\"/_error\\"; query?: Query | undefined }
     | { pathname: \\"/api/[[...segments]]\\"; query?: Query | undefined }
diff --git a/src/test.ts b/src/test.ts
index 9e3d52a..25dd326 100644
--- a/src/test.ts
+++ b/src/test.ts
@@ -18,6 +18,7 @@ describe("route generation", () => {
       "pages/[foo]/bar/[baz]/foo/[bar].ts",
       "pages/[foo]/baz.ts",
       "pages/_app.ts",
+      "pages/middleware.ts",
       "pages/_debug.ts",
       "pages/_debug/health-check.ts",
       "pages/_document.ts",
Repository: tatethurston/nextjs-routes
Pull request #51 (2022-08-08 02:00:12)

Exclude NextJS non routable paths in directories
Also ignore /_error/index. Previously only ignored /_error


Patch:
diff --git a/src/core.ts b/src/core.ts
index 9d3ec7a..16d2778 100644
--- a/src/core.ts
+++ b/src/core.ts
@@ -17,14 +17,24 @@ function convertWindowsPathToUnix(file: string): string {
 }
 
 export function nextRoutes(files: string[], pagesDirectory: string): Route[] {
-  const filenames = files
+  const pathnames = files
+    // remove page directory path
     .map((file) => file.replace(pagesDirectory, ""))
+    // remove file extension
     .map((file) => file.replace(parse(file).ext, ""))
+    // normalize paths from windows users
     .map(convertWindowsPathToUnix)
+    // remove trailign slash
+    .map((file) => file.replace(/index$/, ""))
+    // remove trailing slash if present
+    .map((file) =>
+      file.endsWith("/") && file.length > 2 ? file.slice(0, -1) : file
+    )
+    // exclude nextjs special routes
     .filter((file) => !NEXTJS_NON_ROUTABLE.includes(file));
 
-  return filenames.map((filename) => {
-    const segments = filename.match(DYNAMIC_SEGMENT_RE) ?? [];
+  return pathnames.map((pathname) => {
+    const segments = pathname.match(DYNAMIC_SEGMENT_RE) ?? [];
     const query = segments.reduce<Route["query"]>((acc, cur) => {
       const param = cur
         .replace(/\[/g, "")
@@ -40,14 +50,8 @@ export function nextRoutes(files: string[], pagesDirectory: string): Route[] {
       return acc;
     }, {});
 
-    const pathWithoutIndexSuffix = filename.replace(/index$/, "");
-    const pathWithoutTrailingSlash =
-      pathWithoutIndexSuffix.endsWith("/") && pathWithoutIndexSuffix.length > 2
-        ? pathWithoutIndexSuffix.slice(0, -1)
-        : pathWithoutIndexSuffix;
-
     return {
-      pathname: pathWithoutTrailingSlash,
+      pathname,
       query,
     };
   });


Test patch:
diff --git a/src/__snapshots__/core.test.ts.snap b/src/__snapshots__/core.test.ts.snap
index 9e61a0f..e5c4ce0 100644
--- a/src/__snapshots__/core.test.ts.snap
+++ b/src/__snapshots__/core.test.ts.snap
@@ -104,7 +104,6 @@ declare module \\"nextjs-routes\\" {
     | { pathname: \\"/[foo]/baz\\"; query: Query<{ foo: string }> }
     | { pathname: \\"/_debug\\"; query?: Query | undefined }
     | { pathname: \\"/_debug/health-check\\"; query?: Query | undefined }
-    | { pathname: \\"/_error\\"; query?: Query | undefined }
     | { pathname: \\"/api/[[...segments]]\\"; query?: Query | undefined }
     | { pathname: \\"/api/[...segments]\\"; query: Query<{ segments: string[] }> }
     | { pathname: \\"/api/bar\\"; query?: Query | undefined }
Repository: tclindner/npm-package-json-lint
Pull request #18 (2016-07-27 02:47:40)

Add new rule prefer-no-engineStrict
Added new rule prefer-no-engineStrict


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2bf5f67..799e2da 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 
 ### Removed
 
+## [1.3.0] - 2016-07-26
+### Added
+- New rule: [prefer-no-engineStrict](https://github.com/tclindner/npm-package-json-lint/wiki/prefer-no-engineStrict)
+
 ## [1.2.0] - 2016-07-26
 ### Changed
 - Bump grunt-eslint to version 19.0.0
diff --git a/package.json b/package.json
index 301e976..c29eb05 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "npm-package-json-lint",
-  "version": "1.2.0",
+  "version": "1.3.0",
   "description": "CLI app for linting package.json files.",
   "keywords": [
     "lint",
diff --git a/src/rules/prefer-no-engineStrict.js b/src/rules/prefer-no-engineStrict.js
new file mode 100644
index 0000000..8b45f22
--- /dev/null
+++ b/src/rules/prefer-no-engineStrict.js
@@ -0,0 +1,18 @@
+'use strict';
+
+const LintIssue = require('./../LintIssue');
+const lintId = 'prefer-no-engineStrict';
+const nodeName = 'engineStrict';
+const message = 'engineStrict was deprecated with npm v3.0.0. Please remove it from your package.json file';
+const ruleType = 'deprecated-nodes';
+
+const lint = function(packageJsonData, lintType) {
+  if (packageJsonData.hasOwnProperty(nodeName)) {
+    return new LintIssue(lintId, lintType, nodeName, message);
+  }
+
+  return true;
+};
+
+module.exports.lint = lint;
+module.exports.ruleType = ruleType;


Test patch:
diff --git a/tests/unit/rules/prefer-no-engineStrict.js b/tests/unit/rules/prefer-no-engineStrict.js
new file mode 100644
index 0000000..8f983a4
--- /dev/null
+++ b/tests/unit/rules/prefer-no-engineStrict.js
@@ -0,0 +1,30 @@
+'use strict';
+
+const should = require('should');
+const requireHelper = require('../../require_helper');
+const lint = requireHelper('rules/prefer-no-engineStrict').lint;
+
+describe('prefer-no-engineStrict Unit Tests', function() {
+  context('when package.json has engineStrict node', function() {
+    it('LintIssue object should be returned', function() {
+      const packageJsonData = {
+        engineStrict: 'dummy-value'
+      };
+      const response = lint(packageJsonData, 'error');
+
+      response.lintId.should.equal('prefer-no-engineStrict');
+      response.lintType.should.equal('error');
+      response.node.should.equal('engineStrict');
+      response.lintMessage.should.equal('engineStrict was deprecated with npm v3.0.0. Please remove it from your package.json file');
+    });
+  });
+
+  context('when package.json does not have node', function() {
+    it('true should be returned', function() {
+      const packageJsonData = {};
+      const response = lint(packageJsonData, 'error');
+
+      response.should.be.true();
+    });
+  });
+});
Repository: tclindner/npm-package-json-lint
Pull request #55 (2017-08-24 02:08:40)

#53 - Fix for new array rule, prefer-property-order, not loading properly


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 676f12f..2b7bea1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 
 ### Removed
 
+
+## [2.8.2] - 2017-08-23
+### Fixed
+- Rule loader so it recognized [prefer-property-order](https://github.com/tclindner/npm-package-json-lint/wiki/prefer-property-order) as an array type rule.
+
 ## [2.8.1] - 2017-08-21
 ### Changed/Fixed
 - Updated rule: [prefer-property-order](https://github.com/tclindner/npm-package-json-lint/wiki/prefer-property-order) based on discussion with @moshest in [issue #50](https://github.com/tclindner/npm-package-json-lint/issues/50) and @evilebottnawi in [issue #53](https://github.com/tclindner/npm-package-json-lint/issues/53).
diff --git a/package.json b/package.json
index ff92af5..8aa1502 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "npm-package-json-lint",
-  "version": "2.8.1",
+  "version": "2.8.2",
   "description": "CLI app for linting package.json files.",
   "keywords": [
     "lint",
diff --git a/src/NpmPackageJsonLint.js b/src/NpmPackageJsonLint.js
index 6e5b174..635ef38 100755
--- a/src/NpmPackageJsonLint.js
+++ b/src/NpmPackageJsonLint.js
@@ -17,7 +17,12 @@ class NpmPackageJsonLint {
   constructor(packageJsonData, config, options) {
     this.packageJsonData = packageJsonData;
     this.ignoreWarnings = options.ignoreWarnings;
-    this.arrayRuleTypes = ['valid-values', 'no-restricted-dependencies', 'no-restricted-pre-release-dependencies'];
+    this.arrayRuleTypes = [
+      'valid-values',
+      'no-restricted-dependencies',
+      'no-restricted-pre-release-dependencies',
+      'property-order'
+    ];
     this.errors = [];
     this.warnings = [];
 


Test patch:
diff --git a/tests/fixtures/valid/.npmpackagejsonlintrc.json b/tests/fixtures/valid/.npmpackagejsonlintrc.json
index 0a1ad28..0d8251f 100644
--- a/tests/fixtures/valid/.npmpackagejsonlintrc.json
+++ b/tests/fixtures/valid/.npmpackagejsonlintrc.json
@@ -19,6 +19,24 @@
       "Thomas Lindner"
     ]],
     "name-format": "error",
-    "version-format": "error"
+    "version-format": "error",
+    "prefer-property-order": ["error", [
+      "name",
+      "version",
+      "description",
+      "keywords",
+      "homepage",
+      "bugs",
+      "author",
+      "repository",
+      "bin",
+      "files",
+      "main",
+      "scripts",
+      "dependencies",
+      "devDependencies",
+      "engines",
+      "license"
+    ]]
   }
 }
Repository: refined-github/refined-github
Pull request #7993 (2024-11-01 08:43:16)

`bugs-tab` - Support `issue-bug`
Microsoft PowerToys uses `Issue-Bug` for bug labels. See https://github.com/microsoft/PowerToys/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20label%3AIssue-Bug.

This PR adds support for it. 

This fixes https://github.com/refined-github/refined-github/issues/7991.

## Test URLs

This fixes https://github.com/refined-github/refined-github/issues/7991.

## Screenshot



Patch:
diff --git a/source/github-helpers/bugs-label.ts b/source/github-helpers/bugs-label.ts
index 2fe4ab54..89bb2705 100644
--- a/source/github-helpers/bugs-label.ts
+++ b/source/github-helpers/bugs-label.ts
@@ -1,4 +1,4 @@
-const supportedLabels = /^(?:bug|bug-?fix|confirmed-bug|(?:type|kind|triage)[:/]bug|(?::[\w-]+:|\p{Emoji})bug)$/iu;
+const supportedLabels = /^(?:bug|bug-?fix|confirmed-bug|(?:type|kind|triage|issue)[:/-]bug|(?::[\w-]+:|\p{Emoji})bug)$/iu;
 export default function isBugLabel(label: string): boolean {
 	return supportedLabels.test(label.replaceAll(/\s/g, ''));
 }


Test patch:
diff --git a/source/github-helpers/bugs-label.test.ts b/source/github-helpers/bugs-label.test.ts
index e5ab0bd9..96fe3a7a 100644
--- a/source/github-helpers/bugs-label.test.ts
+++ b/source/github-helpers/bugs-label.test.ts
@@ -9,10 +9,13 @@ bugfix
 confirmed-bug
 type/bug
 type:bug
+type-bug
 kind/bug
 kind:bug
+kind-bug
 triage/bug
 triage:bug
+Issue-Bug
 :bug:bug
 :bug: bug
 🐛bug
@@ -26,8 +29,11 @@ bug-report
 bug-hunt
 bugzilla
 debug
+debugger
 bugatti
+bugia
 ladybug
+not-a-bug
 `;
 
 test('isBugLabel', () => {
Repository: refined-github/refined-github
Pull request #8113 (2024-12-02 03:35:09)

`one-key-formatting` - Enable on commit title fields
- Fixes https://github.com/refined-github/refined-github/issues/7707


## Test URLs

https://github.com/refined-github/refined-github/edit/main/.git-blame-ignore-revs


## Screenshot

![table](https://github.com/user-attachments/assets/72fcaf98-58bd-4656-a3ba-23f4d5e82c1a)



Patch:
diff --git a/source/features/conventional-commits.tsx b/source/features/conventional-commits.tsx
index a7a0c814..ebb23bd7 100644
--- a/source/features/conventional-commits.tsx
+++ b/source/features/conventional-commits.tsx
@@ -23,6 +23,11 @@ function renderLabelInCommitTitle(commitTitleElement: HTMLElement): void {
 		return;
 	}
 
+	// Skip commits that are _only_ "ci:" without anything else. Rare but would be confusing to show just the label
+	if (commit.raw === textNode.textContent && !commitTitleElement.nextElementSibling) {
+		return;
+	}
+
 	commitTitleElement.prepend(
 		<span className="IssueLabel hx_IssueLabel mr-2" rgh-conventional-commits={commit.rawType}>
 			{commit.type}
diff --git a/source/features/one-key-formatting.tsx b/source/features/one-key-formatting.tsx
index 8a195966..5d9b01bc 100644
--- a/source/features/one-key-formatting.tsx
+++ b/source/features/one-key-formatting.tsx
@@ -43,6 +43,7 @@ function init(signal: AbortSignal): void {
 		'input[name="commit_title"]',
 		'input[name="gist[description]"]',
 		'#saved-reply-title-field',
+		'#commit-message-input',
 	], 'keydown', eventHandler, {signal});
 }
 
diff --git a/source/helpers/conventional-commits.ts b/source/helpers/conventional-commits.ts
index daed4d15..4cb683af 100644
--- a/source/helpers/conventional-commits.ts
+++ b/source/helpers/conventional-commits.ts
@@ -1,5 +1,5 @@
 // Using https://www.conventionalcommits.org/ as a reference.
-export const conventionalCommitRegex = /^(?<type>\w+)(?:\((?<scope>.+)\))?(?<major>!)?: /;
+export const conventionalCommitRegex = /^(?<type>\w+)(?:\((?<scope>.+)\))?(?<major>!)?: */;
 
 // Do not send PRs for types not listed here: https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#rules
 // No more types will be added nor do we accept options.


Test patch:
diff --git a/source/helpers/conventional-commits.test.ts b/source/helpers/conventional-commits.test.ts
index 50241d6a..4267986c 100644
--- a/source/helpers/conventional-commits.test.ts
+++ b/source/helpers/conventional-commits.test.ts
@@ -59,8 +59,15 @@ test('parseConventionalCommit', () => {
 		  "type": "Feature",
 		}
 	`);
+	expect(parseConventionalCommit('fix:')).toMatchInlineSnapshot(`
+		{
+		  "raw": "fix:",
+		  "rawType": "fix",
+		  "scope": undefined,
+		  "type": "Fix",
+		}
+	`);
 
-	expect(parseConventionalCommit('feat:')).toBeUndefined();
 	expect(parseConventionalCommit('idk(label): not recognized')).toBeUndefined();
 	expect(parseConventionalCommit('Commit message')).toBeUndefined();
 	expect(parseConventionalCommit('feat(): Commit message')).toBeUndefined();
Repository: refined-github/refined-github
Pull request #8114 (2024-12-02 03:54:20)

`conventional-commits` - Support links following the type
- Fixes https://github.com/refined-github/refined-github/issues/8066


## Notes

- ✅ `ci: #1` is now formatted
- ⚠️ `ci: #1` has a little extra padding after the type because a space character appears _between_ the two elements
- ✅ `ci:` is still skipped
- ℹ️ `fix: #1` has custom formatting already so it's not detected as conventional commit

<img width="323" alt="Screenshot 14" src="https://github.com/user-attachments/assets/a793cb53-628c-46f4-a4f5-34c9e32b13b1">


## Test URLs

https://github.com/refined-github/sandbox/commits/conventional-commits/


## Screenshot
<img width="330" alt="Screenshot" src="https://github.com/user-attachments/assets/fa563e43-d244-4361-b8a5-11a31c3edd5f">



Patch:
diff --git a/source/features/conventional-commits.tsx b/source/features/conventional-commits.tsx
index a7a0c814..ebb23bd7 100644
--- a/source/features/conventional-commits.tsx
+++ b/source/features/conventional-commits.tsx
@@ -23,6 +23,11 @@ function renderLabelInCommitTitle(commitTitleElement: HTMLElement): void {
 		return;
 	}
 
+	// Skip commits that are _only_ "ci:" without anything else. Rare but would be confusing to show just the label
+	if (commit.raw === textNode.textContent && !commitTitleElement.nextElementSibling) {
+		return;
+	}
+
 	commitTitleElement.prepend(
 		<span className="IssueLabel hx_IssueLabel mr-2" rgh-conventional-commits={commit.rawType}>
 			{commit.type}
diff --git a/source/helpers/conventional-commits.ts b/source/helpers/conventional-commits.ts
index daed4d15..4cb683af 100644
--- a/source/helpers/conventional-commits.ts
+++ b/source/helpers/conventional-commits.ts
@@ -1,5 +1,5 @@
 // Using https://www.conventionalcommits.org/ as a reference.
-export const conventionalCommitRegex = /^(?<type>\w+)(?:\((?<scope>.+)\))?(?<major>!)?: /;
+export const conventionalCommitRegex = /^(?<type>\w+)(?:\((?<scope>.+)\))?(?<major>!)?: */;
 
 // Do not send PRs for types not listed here: https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#rules
 // No more types will be added nor do we accept options.


Test patch:
diff --git a/source/helpers/conventional-commits.test.ts b/source/helpers/conventional-commits.test.ts
index 50241d6a..4267986c 100644
--- a/source/helpers/conventional-commits.test.ts
+++ b/source/helpers/conventional-commits.test.ts
@@ -59,8 +59,15 @@ test('parseConventionalCommit', () => {
 		  "type": "Feature",
 		}
 	`);
+	expect(parseConventionalCommit('fix:')).toMatchInlineSnapshot(`
+		{
+		  "raw": "fix:",
+		  "rawType": "fix",
+		  "scope": undefined,
+		  "type": "Fix",
+		}
+	`);
 
-	expect(parseConventionalCommit('feat:')).toBeUndefined();
 	expect(parseConventionalCommit('idk(label): not recognized')).toBeUndefined();
 	expect(parseConventionalCommit('Commit message')).toBeUndefined();
 	expect(parseConventionalCommit('feat(): Commit message')).toBeUndefined();
Repository: dandavison/delta
Pull request #438 (2020-12-08 16:06:15)

Make commit style to be colored with same structure while color_only #405
Same as https://github.com/ulwlu/delta/pull/4, I didn't know but `PR in forked repository` can't be rebased to `original repository` ....so I created again.

## This pr changes below.

- Make commit style to be colored with same structure while color_only

<img width="873" alt="ss 8" src="https://user-images.githubusercontent.com/41639488/101498297-46834480-39af-11eb-90a9-4226abe4b4fe.png">

## Remarks.

- Related to #405 
- This one is the last PR for #405.


Patch:
diff --git a/src/options/set.rs b/src/options/set.rs
index 449619f..5b68ffe 100644
--- a/src/options/set.rs
+++ b/src/options/set.rs
@@ -197,7 +197,6 @@ pub fn set_options(
         opt.side_by_side = false;
         opt.file_decoration_style = "none".to_string();
         opt.commit_decoration_style = "none".to_string();
-        opt.commit_style = "raw".to_string();
         opt.hunk_header_decoration_style = "none".to_string();
     }
 }


Test patch:
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index c96a83e..f412158 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -989,7 +989,6 @@ src/align.rs
     }
 
     #[test]
-    // TODO: commit-style is required to add.
     fn test_hunk_header_style_with_color_only_has_style() {
         let config = integration_test_utils::make_config_from_args(&[
             "--color-only",
@@ -1009,6 +1008,26 @@ src/align.rs
         assert!(output.contains("@@ -71,11 +71,8 @@ impl<'a> Alignment<'a> {"));
     }
 
+    #[test]
+    fn test_commit_style_with_color_only_has_style() {
+        let config = integration_test_utils::make_config_from_args(&[
+            "--color-only",
+            "--commit-style",
+            "red",
+        ]);
+        let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config);
+
+        ansi_test_utils::assert_line_has_style(
+            &output,
+            0,
+            "commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e",
+            "red",
+            &config,
+        );
+        let output = strip_ansi_codes(&output);
+        assert!(output.contains("commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e"));
+    }
+
     #[test]
     fn test_hunk_header_style_colored_input_color_is_stripped_under_normal() {
         let config = integration_test_utils::make_config_from_args(&[