Coder Social home page Coder Social logo

ljosberinn / eslint-config-galex Goto Github PK

View Code? Open in Web Editor NEW
175.0 3.0 9.0 9.28 MB

hopefully the last eslint config you'll ever need - customizable & modern best practices for JS, TS, Node, React, Remix, Next, Jest, testing-library & storybook

Home Page: https://www.npmjs.com/package/eslint-config-galex

License: MIT License

JavaScript 6.90% CSS 3.93% TypeScript 88.97% Dockerfile 0.21%
eslint eslint-config react typescript esnext nextjs jest testing-library best-practices rulesets

eslint-config-galex's Introduction

const readMePlease = {
  greetings: "stranger πŸ‘‹",
  iAm: "Gerrit Alex",
  usually: "building things",
  in: "TypeScript, Full Stack",
  findMeOn: [{ twitter: "@gerrit_alex" }, { discord: "Chevron#6539" }],
};

eslint-config-galex's People

Contributors

axelboc avatar dependabot-preview[bot] avatar dependabot[bot] avatar ljosberinn avatar mergify[bot] avatar muametgrooby avatar renovate-bot avatar renovate[bot] avatar semantic-release-bot avatar themaru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eslint-config-galex's Issues

Parsing error: Unexpected token <

I'm using these eslint rules in a monorepo across two packages (studio and web). On the studio package it works absolutely fine, but on the web package it doesn't seem to be working at all and I get the above error.

The web package is using NextJS so perhaps I'm missing something. I've tried all manor of things to get it working like adding parsing options, babel configs, etc, but nothing seems to work.

I was wondering if I was missing something? I made the repo public below...

https://github.com/Modular-Everything/UEFA

Edit: I'm just noticing that the linting is working, but only in certain files. Editing sanity.js I get the linting errors, but the error mentioned in the title comes from editing index.js

CRA depends on eslint-plugin-testing-library@^3.9.2

The latest release of eslint-config-galex bumps eslint-plugin-testing-library to version 3.10.0, which is incompatible with react-scripts v4.0. As a result, I'm getting the following error:

Definition for rule 'testing-library/no-await-sync-events' was not found testing-library/no-await-sync-events

I'm using NPM so I can't yet override module resolutions.

disable slow rules

import/no-useless-path-segments ~ 25%
import/no-cycle ~ 14%
import/no-extraneous-dependencies ~ 13%
import/no-self-import ~ 11%

consider disabling the following aswell:
@typescript-eslint/no-confusing-void-expression ~ 4%
@typescript-eslint/no-floating-promises ~ 2%

Trouble using with Create React App

I have a React app bootstrapped with Create React App. I added this eslint config as per the instructions.
Upon running running eslint on the src directory, I got a lot of errors on files that come by default from CRA (eg.: serviceWorker.ts).

How should this be handled? I tried adding react-app to the extensions in the eslint config, but it introduced additional problems and in the end it did not help.

disable no-void

conflicts with no-floating-promises or whatever its called and voiding those should be allowed

bug: avoid adding similar overrides multiple times

right now, adding a react override will lead to this order:

  • react override
  • ts override
  • others
  • ...custom

this can lead to issues if you want to configure react rules in a TS react project, as the order is still important - the final react override will take precedence over the default TS override, which results in an error because of a missing parser for @typescript-eslint/eslint-plugin

if each createXYOverride would be uniquely identifiyable internally we could filter overrides before adding customOverrides and maintain the same order

allow injecting module globals into create functions too

e.g.

const env = {
  jest: true,
};

const extendsConfig = ['plugin:jest-formatting/strict'];
const files = ['**/*.?(test|spec).?(ts|js)?(x)'];
const parserOptions = {
  ecmaVersion: 2020,
};

const settings = {
  jest: {
    version: 'detect',
  },
};

/**
 * @param {{
 *  hasJestDom: boolean;
 *  hasJest: boolean;
 *  hasTestingLibrary: boolean;
 *  react: {
 *    hasReact: boolean;
 *  };
 *  typescript: {
 *    hasTypeScript: boolean;
 *  };
 *  customRules?: Record<string, string | [string, string | object];
 * }} options
 */
const createJestOverride = ({
  hasJestDom,
  hasJest,
  hasTestingLibrary,
  react,
  typescript,
  // these bad boys here
  customExtends,
  customEnv,
  customSettings,
  // ^^^^^^^
  customRules = {},
}) => {
  // ...
  return {
    env: customEnv ?? env,
  }
}

[jest] disable rules

  ...(hasReact ? { 'react/button-has-type': 'off' } : null),
  ...(hasReact ? { 'jsx-a11y/control-has-associated-label': 'off' } : null),
  'require-unicode-regexp': 'off',
  'no-param-reassign': 'off',

Migrate to TS

kinda wanna ship types and definitely dont want to sync jsdoc comments across the codebase

next version (not necessarily major)

  • move to typescript. will be tough and there are some typing issues technically present. at the very least use // @ts-check everywhere
  • a standalone UI to create a config? πŸ€” esp. relevant for those that are unfamiliar with the eslint config schema and how overrides work
  • add CLI capability to statically generate a config (including recommended postinstall step e.g.)

Add `/` marker to spaced-comment config

In CRA, there's a file called react-app-env.d.ts with a triple-slash comment:

image

I believe spaced-comment can be configured as such to remove the warning:

"spaced-comment": ["error", "always", { "markers": ["/"] }]

Configuration for rule "@typescript-eslint/ban-ts-comment" is invalid

Hey, I'm getting the following error when launching eslint through the command line:

$ npx eslint src --fix
.eslintrc.js#overrides[1]:
        Configuration for rule "@typescript-eslint/ban-ts-comment" is invalid:
        Value "allow-with-description" should be boolean.

This seems to stop the linting completely. I thought manually overriding the rule should help, but it doesn't:

module.exports = {
  extends: 'galex',
  rules: {
    '@typescript-eslint/ban-ts-comment': 0,
  },
};

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

@typescript-eslint/non-nullable-type-assertion-style conflicts with other rule

The code below in my codebase triggers a warning suggesting I use ! instead of as Entity. The warning comes from this rule: @typescript-eslint/non-nullable-type-assertion-style.

if (childCache.has(path)) {
  return childCache.get(path) as Entity;
}

However, when I make the change, I get an error because of rule @typescript-eslint/no-non-null-assertion. I personally prefer the casting to be explicit -- ! can easily be missed -- so I would recommend disabling @typescript-eslint/non-nullable-type-assertion-style.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.