nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: ember-cli/eslint-plugin-ember
Pull request #621 (2019-12-05 13:08:33)

Fix false positive with `ignoreNonThisExpressions` option in `use-ember-get-and-set` rule
Currently, every expression using `this.{method}()` will raise an error `Use get/seteslint(ember/use-ember-get-and-set)`

Here is a fix + test.


Patch:
diff --git a/lib/rules/use-ember-get-and-set.js b/lib/rules/use-ember-get-and-set.js
index 5cd43c86..ef08be07 100644
--- a/lib/rules/use-ember-get-and-set.js
+++ b/lib/rules/use-ember-get-and-set.js
@@ -128,17 +128,17 @@ module.exports = {
         ) {
           return;
         }
+
         // Skip calls made on this
         if (options.ignoreThisExpressions && isThisExpression(callee.object)) {
           return;
         }
-        // Only lint calls made on this
-        if (options.ignoreNonThisExpressions && isThisExpression(callee.object)) {
-          report(node);
-          return;
-        } else if (options.ignoreNonThisExpressions) {
+
+        // Skip calls made on non this expression
+        if (options.ignoreNonThisExpressions && !isThisExpression(callee.object)) {
           return;
         }
+
         // Skip calls made on Ember methods
         if (isIdentifier(callee.object) && callee.object.name === emberImportAliasName) {
           return;


Test patch:
diff --git a/tests/lib/rules/use-ember-get-and-set.js b/tests/lib/rules/use-ember-get-and-set.js
index 365e4b5f..54d504d2 100644
--- a/tests/lib/rules/use-ember-get-and-set.js
+++ b/tests/lib/rules/use-ember-get-and-set.js
@@ -60,6 +60,11 @@ eslintTester.run('use-ember-get-and-set', rule, {
       parserOptions: { ecmaVersion: 6, sourceType: 'module' },
       options: [{ ignoreNonThisExpressions: true }],
     },
+    {
+      code: 'this.test("ok")',
+      parserOptions: { ecmaVersion: 6, sourceType: 'module' },
+      options: [{ ignoreNonThisExpressions: true }],
+    },
 
     // ignoreThisExpressions
     {
Repository: ember-cli/eslint-plugin-ember
Pull request #705 (2020-03-12 04:31:55)

Support TypeScript files when checking if rules are running on Ember module or test files


Patch:
diff --git a/lib/utils/ember.js b/lib/utils/ember.js
index ed89a09b..37f4af16 100644
--- a/lib/utils/ember.js
+++ b/lib/utils/ember.js
@@ -145,15 +145,18 @@ function isDSModel(node, filePath) {
 }
 
 function isModuleByFilePath(filePath, module) {
-  const fileName = `${module}.js`;
+  const fileNameJs = `${module}.js`;
+  const fileNameTs = `${module}.ts`;
   const folderName = `${module}s`;
 
   /* Check both folder and filename to support both classic and POD's structure */
-  return filePath.includes(fileName) || filePath.includes(folderName);
+  return (
+    filePath.includes(fileNameJs) || filePath.includes(fileNameTs) || filePath.includes(folderName)
+  );
 }
 
 function isTestFile(fileName) {
-  return fileName.endsWith('-test.js');
+  return fileName.endsWith('-test.js') || fileName.endsWith('-test.ts');
 }
 
 function isEmberObject(node) {


Test patch:
diff --git a/tests/lib/utils/ember-test.js b/tests/lib/utils/ember-test.js
index 1c52024d..44312ddf 100644
--- a/tests/lib/utils/ember-test.js
+++ b/tests/lib/utils/ember-test.js
@@ -81,12 +81,17 @@ describe('isModuleByFilePath', () => {
     const filePath = 'example-app/routes/path/to/some-feature/route.js';
     expect(emberUtils.isModuleByFilePath(filePath, 'route')).toBeTruthy();
   });
+
+  it('should handle TypeScript files', () => {
+    const filePath = 'example-app/components/path/to/some-component.ts';
+    expect(emberUtils.isModuleByFilePath(filePath, 'component')).toBeTruthy();
+  });
 });
 
 describe('isTestFile', () => {
   it('detects test files', () => {
-    const fileName = 'some-test.js';
-    expect(emberUtils.isTestFile(fileName)).toBeTruthy();
+    expect(emberUtils.isTestFile('some-test.js')).toBeTruthy();
+    expect(emberUtils.isTestFile('some-test.ts')).toBeTruthy();
   });
 
   it('does not detect other files', () => {
Repository: ember-cli/eslint-plugin-ember
Pull request #713 (2020-03-15 18:00:20)

Add tests to ensure each rule documentation file has the right title and an examples section
These are the two parts that every rule documentation file should have.


Patch:
diff --git a/docs/rules/alias-model-in-controller.md b/docs/rules/alias-model-in-controller.md
index b8731d0a..b273a13e 100644
--- a/docs/rules/alias-model-in-controller.md
+++ b/docs/rules/alias-model-in-controller.md
@@ -1,6 +1,10 @@
 # alias-model-in-controller
 
-It makes code more readable if the model has the same name as a subject. We can do this in two ways:
+It makes code more readable if the model has the same name as a subject.
+
+## Examples
+
+We can do this in two ways:
 
 - Alias the model to another property name in the Controller:
 
diff --git a/docs/rules/order-in-components.md b/docs/rules/order-in-components.md
index 9cbc6259..bd6bd6ce 100644
--- a/docs/rules/order-in-components.md
+++ b/docs/rules/order-in-components.md
@@ -80,6 +80,8 @@ You should write code grouped and ordered in this way:
 7. Actions
 8. Custom / private methods
 
+## Examples
+
 ```javascript
 const {
   Component,
diff --git a/docs/rules/order-in-controllers.md b/docs/rules/order-in-controllers.md
index 8d82e7a1..f7c2a0e9 100644
--- a/docs/rules/order-in-controllers.md
+++ b/docs/rules/order-in-controllers.md
@@ -58,6 +58,8 @@ You should write code grouped and ordered in this way:
 9. Actions
 10. Custom / private methods
 
+## Examples
+
 ```javascript
 const {
   Controller,
diff --git a/docs/rules/order-in-models.md b/docs/rules/order-in-models.md
index 4299996b..c3b56251 100644
--- a/docs/rules/order-in-models.md
+++ b/docs/rules/order-in-models.md
@@ -48,6 +48,8 @@ You should write code grouped and ordered in this way:
 4. Multiline computed properties
 5. Other structures (custom methods etc.)
 
+## Examples
+
 ```javascript
 // GOOD
 export default Model.extend({
diff --git a/docs/rules/order-in-routes.md b/docs/rules/order-in-routes.md
index 4ae1ea2d..c7eb8797 100644
--- a/docs/rules/order-in-routes.md
+++ b/docs/rules/order-in-routes.md
@@ -77,6 +77,8 @@ You should write code grouped and ordered in this way:
 8. Actions
 9. Custom / private methods
 
+## Examples
+
 ```javascript
 const {
   Route,


Test patch:
diff --git a/tests/rule-setup.js b/tests/rule-setup.js
index b9e7a485..6b9c8f98 100644
--- a/tests/rule-setup.js
+++ b/tests/rule-setup.js
@@ -55,6 +55,16 @@ describe('rules setup is correct', function() {
     );
   });
 
+  it('should have the right title and an "Examples" section for each rule documentation file', function() {
+    RULE_NAMES.forEach(ruleName => {
+      const path = join(__dirname, '..', 'docs', 'rules', `${ruleName}.md`);
+      const file = readFileSync(path, 'utf8');
+
+      expect(file).toContain(`# ${ruleName}`); // Title header.
+      expect(file).toContain('## Examples'); // Examples section header.
+    });
+  });
+
   it('should mention all rules in the README', function() {
     const path = join(__dirname, '..', 'README.md');
     const file = readFileSync(path, 'utf8');