eslint-config-adslot 1.5.1 → 1.6.1

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/index.js CHANGED
@@ -42,6 +42,7 @@ module.exports = {
42
42
  'lodash',
43
43
  'chai-friendly',
44
44
  'jest',
45
+ 'adslot',
45
46
  ],
46
47
 
47
48
  extends: ['prettier'],
@@ -328,5 +329,7 @@ module.exports = {
328
329
  // could also be used in non-jest tests
329
330
  'jest/no-disabled-tests': 'error',
330
331
  'jest/no-focused-tests': 'error',
332
+
333
+ 'adslot/no-snapshot': 'error',
331
334
  },
332
335
  };
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "eslint-config-adslot",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
4
4
  "description": "ESLint configuration for Adslot",
5
5
  "main": "index.js",
6
6
  "files": [
7
- "index.js"
7
+ "index.js",
8
+ "plugin"
8
9
  ],
9
10
  "repository": {
10
11
  "type": "git",
@@ -31,19 +32,20 @@
31
32
  "release:patch": "npm version patch -m 'build: release patch version %s'"
32
33
  },
33
34
  "dependencies": {
34
- "@typescript-eslint/eslint-plugin": "^5.58.0",
35
- "@typescript-eslint/parser": "^5.58.0",
35
+ "@typescript-eslint/eslint-plugin": "^5.61.0",
36
+ "@typescript-eslint/parser": "^5.61.0",
36
37
  "confusing-browser-globals": "^1.0.11",
37
38
  "eslint-config-prettier": "^8.8.0",
39
+ "eslint-plugin-adslot": "file:plugin",
38
40
  "eslint-plugin-chai-friendly": "^0.7.2",
39
41
  "eslint-plugin-import": "^2.27.5",
40
- "eslint-plugin-jest": "^27.2.1",
42
+ "eslint-plugin-jest": "^27.2.2",
41
43
  "eslint-plugin-jsx-a11y": "^6.7.1",
42
44
  "eslint-plugin-lodash": "^7.4.0",
43
45
  "eslint-plugin-react": "^7.32.2",
44
46
  "eslint-plugin-react-hooks": "^4.6.0"
45
47
  },
46
48
  "peerDependencies": {
47
- "eslint": "^8.38.0"
49
+ "eslint": "^8.44.0"
48
50
  }
49
51
  }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'no-snapshot': require('./no-snapshot'),
4
+ },
5
+ };
@@ -0,0 +1,37 @@
1
+ function isSnapshot(name) {
2
+ return [
3
+ 'toMatchSnapshot',
4
+ 'toMatchInlineSnapshot',
5
+ 'toThrowErrorMatchingSnapshot',
6
+ 'toThrowErrorMatchingInlineSnapshot',
7
+ ].some((method) => method === name);
8
+ }
9
+
10
+ const noSnapshot = {
11
+ meta: {
12
+ docs: {
13
+ description: 'Disallows jest snapshots.',
14
+ },
15
+ messages: {
16
+ notAllowed: 'Snapshot testing is disallowed',
17
+ },
18
+ fixable: 'code',
19
+ },
20
+
21
+ create(context) {
22
+ return {
23
+ CallExpression({ callee: { property } }) {
24
+ if (isSnapshot(property && property.name)) {
25
+ context.report({
26
+ message:
27
+ 'Do not use {{method}} or related methods that generate jest snapshots.',
28
+ node: property,
29
+ data: { method: property.name },
30
+ });
31
+ }
32
+ },
33
+ };
34
+ },
35
+ };
36
+
37
+ module.exports = noSnapshot;
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "eslint-plugin-adslot",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "author": "",
7
+ "license": "ISC"
8
+ }