1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/development
Elliot Winkler 1e494f3004
Refactor ESLint config (#13482)
We would like to insert TypeScript into the ESLint configuration, and
because of the way that the current config is organized, that is not
easy to do.

Most files are assumed to be files that are suited for running in a
browser context. This isn't correct, as we should expect most files to
work in a Node context instead. This is because all browser-based files
will be run through a transpiler that is able to make use of
Node-specific variables anyway.

There are a couple of important ways we can categories files which our
ESLint config should be capable of handling well:

* Is the file a script or a module? In other words, does the file run
  procedurally or is the file intended to be brought into an existing
  file?
* If the file is a module, does it use the CommonJS syntax (`require()`)
  or does it use the ES syntax (`import`/`export`)?

When we introduce TypeScript, this set of questions will become:

* Is the file a script or a module?
* If the file is a module, is it a JavaScript module or a TypeScript
  module?
* If the file is a JavaScript module, does it use the CommonJS syntax
  (`require()`) or does it use the ES syntax (`import`/`export`)?

To represent these divisions, this commit removes global rules — so now
all of the rules are kept in `overrides` for explicitness — and sets up
rules for CommonJS- and ES-module-compatible files that intentionally do
not overlap with each other. This way TypeScript (which has its own set
of rules independent from JavaScript and therefore shouldn't overlap
with the other rules either) can be easily added later.

Finally, this commit splits up the ESLint config into separate files and
adds documentation to each section. This way sets of rules which are
connected to a particular plugin (`jsdoc`, `@babel`, etc.) can be easily
understood instead of being obscured.
2022-02-28 10:42:09 -07:00
..
build Refactor ESLint config (#13482) 2022-02-28 10:42:09 -07:00
highlights Add JSDoc ESLint rules (#12112) 2022-01-07 12:27:33 -03:30
lib Add JSDoc ESLint rules (#12112) 2022-01-07 12:27:33 -03:30
states Support for GridPlus Lattice1 hardware wallet (#12053) 2021-11-08 11:18:41 -03:30
announcer.js Migrate version from _base manifest to package.json (#11029) 2021-05-10 14:16:03 -07:00
chromereload.js Build - refactor background process to use html (#10769) 2021-03-31 11:12:28 +08:00
create-static-server.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
empty.js Build - refactor background process to use html (#10769) 2021-03-31 11:12:28 +08:00
generate-lavamoat-policies.sh Fix LavaMoat background policy generation (#12844) 2021-11-26 16:38:23 -03:30
generate-migration.sh Fixing migration script generation paths (#10664) 2021-03-17 12:21:46 +08:00
gource-viz.sh dev - move gource instructions from docs to development script 2019-09-10 22:05:16 +08:00
jest.config.js Update Jest coverage reporters (#12845) 2021-12-01 15:16:34 -03:30
metamaskbot-build-announce.js Update ESLint config to v8 (#12886) 2021-12-09 15:36:24 -03:30
missing-locale-strings.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
mock-3box.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
mock-e2e.js E2e phishing detection (#13704) 2022-02-22 16:48:12 +00:00
mock-segment.js Remove unused SEGMENT_LEGACY_WRITE_KEY (#12429) 2021-10-22 10:34:37 -02:30
README.md Build: Lint files after removing their code fences (#12075) 2021-09-15 17:18:28 -10:00
run-ganache.sh Adding support for EIP-1559 in E2E tests (#13282) 2022-01-19 04:38:41 +05:30
sentry-publish.js Show Sentry CLI output when uploading artifacts (#11100) 2021-05-19 14:54:45 -02:30
sentry-upload-artifacts.sh Show Sentry CLI output when uploading artifacts (#11100) 2021-05-19 14:54:45 -02:30
shellcheck.sh Add lint:shellcheck:package (#7568) 2019-12-11 15:52:08 -05:00
show-deps-install-scripts.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
source-map-explorer.sh Excluding sourcemaps comment in production builds (#10695) 2021-03-22 19:41:23 -07:00
sourcemap-validator.js Using a normal bundle instead of a factored bundle for phishing-detect (build sys) (#11972) 2021-08-30 17:58:50 -10:00
static-server.js @metamask/eslint config@5.0.0 (#10358) 2021-02-04 10:15:23 -08:00
stream-flat-map.js Build - refactor for bundle factoring and swappable runtime (#11080) 2021-07-15 10:59:34 -07:00
verify-locale-strings.js Fix manifest i18n substitutions for Beta and Flask (#12717) 2021-11-16 08:43:21 -08:00

Development

Several files which are needed for developing on MetaMask.

Usually each file or directory contains information about its scope / usage.