.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / @eslint / eslintrc / conf / environments.js
1 /**
2  * @fileoverview Defines environment settings and globals.
3  * @author Elan Shanker
4  */
5 "use strict";
6
7 //------------------------------------------------------------------------------
8 // Requirements
9 //------------------------------------------------------------------------------
10
11 const globals = require("globals");
12
13 //------------------------------------------------------------------------------
14 // Helpers
15 //------------------------------------------------------------------------------
16
17 /**
18  * Get the object that has difference.
19  * @param {Record<string,boolean>} current The newer object.
20  * @param {Record<string,boolean>} prev The older object.
21  * @returns {Record<string,boolean>} The difference object.
22  */
23 function getDiff(current, prev) {
24     const retv = {};
25
26     for (const [key, value] of Object.entries(current)) {
27         if (!Object.hasOwnProperty.call(prev, key)) {
28             retv[key] = value;
29         }
30     }
31
32     return retv;
33 }
34
35 const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...
36 const newGlobals2017 = {
37     Atomics: false,
38     SharedArrayBuffer: false
39 };
40 const newGlobals2020 = {
41     BigInt: false,
42     BigInt64Array: false,
43     BigUint64Array: false,
44     globalThis: false
45 };
46
47 const newGlobals2021 = {
48     AggregateError: false,
49     FinalizationRegistry: false,
50     WeakRef: false
51 };
52
53 //------------------------------------------------------------------------------
54 // Public Interface
55 //------------------------------------------------------------------------------
56
57 /** @type {Map<string, import("../lib/shared/types").Environment>} */
58 module.exports = new Map(Object.entries({
59
60     // Language
61     builtin: {
62         globals: globals.es5
63     },
64     es6: {
65         globals: newGlobals2015,
66         parserOptions: {
67             ecmaVersion: 6
68         }
69     },
70     es2015: {
71         globals: newGlobals2015,
72         parserOptions: {
73             ecmaVersion: 6
74         }
75     },
76     es2017: {
77         globals: { ...newGlobals2015, ...newGlobals2017 },
78         parserOptions: {
79             ecmaVersion: 8
80         }
81     },
82     es2020: {
83         globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },
84         parserOptions: {
85             ecmaVersion: 11
86         }
87     },
88     es2021: {
89         globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },
90         parserOptions: {
91             ecmaVersion: 12
92         }
93     },
94
95     // Platforms
96     browser: {
97         globals: globals.browser
98     },
99     node: {
100         globals: globals.node,
101         parserOptions: {
102             ecmaFeatures: {
103                 globalReturn: true
104             }
105         }
106     },
107     "shared-node-browser": {
108         globals: globals["shared-node-browser"]
109     },
110     worker: {
111         globals: globals.worker
112     },
113     serviceworker: {
114         globals: globals.serviceworker
115     },
116
117     // Frameworks
118     commonjs: {
119         globals: globals.commonjs,
120         parserOptions: {
121             ecmaFeatures: {
122                 globalReturn: true
123             }
124         }
125     },
126     amd: {
127         globals: globals.amd
128     },
129     mocha: {
130         globals: globals.mocha
131     },
132     jasmine: {
133         globals: globals.jasmine
134     },
135     jest: {
136         globals: globals.jest
137     },
138     phantomjs: {
139         globals: globals.phantomjs
140     },
141     jquery: {
142         globals: globals.jquery
143     },
144     qunit: {
145         globals: globals.qunit
146     },
147     prototypejs: {
148         globals: globals.prototypejs
149     },
150     shelljs: {
151         globals: globals.shelljs
152     },
153     meteor: {
154         globals: globals.meteor
155     },
156     mongo: {
157         globals: globals.mongo
158     },
159     protractor: {
160         globals: globals.protractor
161     },
162     applescript: {
163         globals: globals.applescript
164     },
165     nashorn: {
166         globals: globals.nashorn
167     },
168     atomtest: {
169         globals: globals.atomtest
170     },
171     embertest: {
172         globals: globals.embertest
173     },
174     webextensions: {
175         globals: globals.webextensions
176     },
177     greasemonkey: {
178         globals: globals.greasemonkey
179     }
180 }));