New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-amo

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-amo - npm Package Compare versions

Comparing version 1.9.1 to 1.10.0

lib/rules/only-tsx-files.js

44

lib/index.js

@@ -11,14 +11,36 @@ 'use strict';

// Default configuration.
const recommended = {
plugins: ['amo'],
rules: ruleIds
.filter(
(ruleId) =>
allRules[ruleId].meta.docs.recommended &&
!allRules[ruleId].meta.docs.typescript
)
.reduce((acc, ruleId) => {
return Object.assign({}, acc, {
[`amo/${ruleId}`]: 2,
});
}, {}),
};
const typescript = {
...recommended,
rules: ruleIds
.filter(
(ruleId) =>
allRules[ruleId].meta.docs.recommended &&
allRules[ruleId].meta.docs.typescript
)
.reduce((acc, ruleId) => {
return Object.assign({}, acc, {
[`amo/${ruleId}`]: 2,
});
}, {}),
};
// Configuration variants.
module.exports.configs = {
recommended: {
plugins: ['amo'],
rules: ruleIds
.filter((ruleId) => allRules[ruleId].meta.docs.recommended)
.reduce((acc, ruleId) => {
return Object.assign({}, acc, {
[`amo/${ruleId}`]: 2,
});
}, {}),
},
recommended,
typescript,
};
{
"name": "eslint-plugin-amo",
"version": "1.9.1",
"version": "1.10.0",
"description": "ESLint plugin for AMO",

@@ -5,0 +5,0 @@ "keywords": [

@@ -52,2 +52,12 @@ # eslint-plugin-amo

### TypeScript
You can use the `typescript` preset to get reasonable defaults (it includes the `recommended` rules) as well as TypeScript specific rules:
```json
{
"extends": ["plugin:amo/typescript"]
}
```
## Rules

@@ -65,2 +75,3 @@

- [`only-log-strings`](#only-log-strings)
- [`only-tsx-files`](#only-tsx-files)
- [`redux-app-state`](#redux-app-state)

@@ -174,2 +185,11 @@ - [`sort-destructured-props`](#sort-destructured-props)

### `only-tsx-files`
Enforce `.tsx` file extensions:
- ⛔️ `src/api/index.ts`
- ✅ `src/api/index.tsx`
:bulb: We enforce this rule because of the following issue: https://github.com/mozilla/addons-code-manager/issues/75.
### `redux-app-state`

@@ -176,0 +196,0 @@

@@ -15,6 +15,18 @@ const assert = require('assert');

it('provides a "recommended" configuration', () => {
assert.ok(typeof plugin.configs.recommended === 'object');
assert.deepEqual(plugin.configs.recommended.plugins, ['amo']);
assert.ok(typeof plugin.configs.recommended.rules === 'object');
const config = plugin.configs.recommended;
assert.ok(typeof config === 'object');
assert.deepEqual(config.plugins, ['amo']);
assert.ok(typeof config.rules === 'object');
assert.ok(config.rules['amo/only-tsx-files'] === undefined);
});
it('provides a "typescript" configuration', () => {
const config = plugin.configs.typescript;
assert.ok(typeof config === 'object');
assert.deepEqual(config.plugins, ['amo']);
assert.ok(typeof config.rules === 'object');
assert.ok(config.rules['amo/only-tsx-files'] !== undefined);
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc