Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: consolidate eslint config #627

Merged
merged 4 commits into from
Aug 22, 2023
Merged

Commits on Aug 22, 2023

  1. chore: consolidate eslint config

    This change:
    
    - Removes all `.eslintignore` , `.eslintrc` files or `package.json`-embedded config and replaces it with a single root `.eslintrc.js`
    - Removes all lint-related scripts from all workspaces (including `depcheck`)
    - Removes all dev deps on `eslint` and its ilk (and `ava`, since it will come from the workspace root)
    - Upgrades `@metamask/eslint-config-nodejs`, `eslint`, `eslint-plugin-ava`, as well as other plugins used by specific packages; moves them all to workspace root
    - Removes unused/deprecated `eslint-plugin-node` in lieu of `eslint-plugin-n`, which the new version of `@metamask/eslint-config-nodejs` needs
    - Adds a prettier config (in case someone wants to use it; I'd like to add it to our workflow later)
    
    I note that ESLint seemed to be misconfigured before this change; none of the rules specified in the root config were being checked.  This means that there are a whole lot of lint fixes that need to be made.
    
    To lint, run `yarn lint` as before (which will also run `depcheck`) from the workspace root.  Likewise, `lint:fix` runs a fix, and `lint:depcheck` will use lerna to run `lint:depcheck` wherever it is defined.
    boneskull committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    d40c8f2 View commit details
    Browse the repository at this point in the history
  2. chore: lint all the things

    boneskull committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    5e27065 View commit details
    Browse the repository at this point in the history
  3. chore(deps): remove @metamask/eslint-config-nodejs

    Closes #637
    
    This removes the dep on `@metamask/eslint-config-nodejs` which has a peer dep on `@metamask/eslint-config`.  `npm` will automatically install that module, and that module _itself_ has peer deps which may also conflict with our deps currently or in the future.
    
    Given `@metamask/eslint-config-nodejs` is _intended_ to be used with `@metamask/eslint-config`, we then must drop it.
    
    The ESLint config has been modified to extend both `eslint/recommended` and `eslint-plugin-n/recommended` configs.  Extra rules were copied from `@metamask/eslint-config-nodejs`, but many (such as restrictions on browser-only globals) were not, since these can be trivially addressed by ESLint's `env` configuration (unsure what they are doing where this is a problem).  Since this surfaced a whole lot of new issues--especially in test code and templates--additional overrides were necessary.  Any rules which were removed from the main `rules` prop were likely already enabled in `eslint/recommended`.
    
    # Conflicts:
    #	package-lock.json
    #	package.json
    boneskull committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    6d5a15f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    85e402f View commit details
    Browse the repository at this point in the history