main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | /**
|
---|
2 | * @fileoverview Rule to check for properties whose identifier ends with the string Sync
|
---|
3 | * @author Matt DuVall<http://mattduvall.com/>
|
---|
4 | * @deprecated in ESLint v7.0.0
|
---|
5 | */
|
---|
6 |
|
---|
7 | "use strict";
|
---|
8 |
|
---|
9 | //------------------------------------------------------------------------------
|
---|
10 | // Rule Definition
|
---|
11 | //------------------------------------------------------------------------------
|
---|
12 |
|
---|
13 | /** @type {import('../shared/types').Rule} */
|
---|
14 | module.exports = {
|
---|
15 | meta: {
|
---|
16 | deprecated: true,
|
---|
17 |
|
---|
18 | replacedBy: [],
|
---|
19 |
|
---|
20 | type: "suggestion",
|
---|
21 |
|
---|
22 | docs: {
|
---|
23 | description: "Disallow synchronous methods",
|
---|
24 | recommended: false,
|
---|
25 | url: "https://eslint.org/docs/latest/rules/no-sync"
|
---|
26 | },
|
---|
27 |
|
---|
28 | schema: [
|
---|
29 | {
|
---|
30 | type: "object",
|
---|
31 | properties: {
|
---|
32 | allowAtRootLevel: {
|
---|
33 | type: "boolean",
|
---|
34 | default: false
|
---|
35 | }
|
---|
36 | },
|
---|
37 | additionalProperties: false
|
---|
38 | }
|
---|
39 | ],
|
---|
40 |
|
---|
41 | messages: {
|
---|
42 | noSync: "Unexpected sync method: '{{propertyName}}'."
|
---|
43 | }
|
---|
44 | },
|
---|
45 |
|
---|
46 | create(context) {
|
---|
47 | const selector = context.options[0] && context.options[0].allowAtRootLevel
|
---|
48 | ? ":function MemberExpression[property.name=/.*Sync$/]"
|
---|
49 | : "MemberExpression[property.name=/.*Sync$/]";
|
---|
50 |
|
---|
51 | return {
|
---|
52 | [selector](node) {
|
---|
53 | context.report({
|
---|
54 | node,
|
---|
55 | messageId: "noSync",
|
---|
56 | data: {
|
---|
57 | propertyName: node.property.name
|
---|
58 | }
|
---|
59 | });
|
---|
60 | }
|
---|
61 | };
|
---|
62 |
|
---|
63 | }
|
---|
64 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.