NullVoxPopuli / eslint-configs

My Preferred ESLint configs for all my projects. Uses only overrides so that they're easy to maintain and update
9 stars 6 forks source link

n/no-unpublished-require for @nullvoxpopuli/eslint-configs #545

Closed basz closed 10 months ago

basz commented 10 months ago

I'm seeing two different errors in .eslint.cjs using the following config.

'use strict';

const { configs } = require('@nullvoxpopuli/eslint-configs');

const config = configs.ember();

module.exports = {
  ...config,
  overrides: [
    ...config.overrides,
    {
      files: ['**/*.{t,gt}s'],
      rules: {
        /**
         * This one is incorrectly parsed for now, because
         * the rule doesn't understand decorators
         */
        '@typescript-eslint/no-unused-vars': 'off',
        /**
         * any can be useful
         */
        '@typescript-eslint/no-explicit-any': 'off',
        /**
         * there is heavy use of `object` in this library
         */
        '@typescript-eslint/ban-types': 'off',
        /**
         * The following types do are not defined by the definitely typed packages
         * - @glimmer/tracking/primitives/cache
         *   - getValue
         * - @ember/helper
         *   - invokeHelper
         *   - capabilities
         *   - setHelperManager
         */
        '@typescript-eslint/ban-ts-comment': 'off',

        'ember/use-ember-data-rfc-395-imports': 'warn',
        'ember/no-empty-glimmer-component-classes': 'warn',
      },
    },
  ],
};

In an app I see this;

Could not find a declaration file for module '@nullvoxpopuli/eslint-configs'. '/Users/bas/Documents/Projects/BeautifullyPrintedMatter/Api-Application/node_modules/.pnpm/@nullvoxpopuli+eslint-configs@3.2.2_@babel+core@7.22.20_@babel+eslint-parser@7.22.15_eslint-c_eqnj277wc6jsd5gn5dqrwudc5i/node_modules/@nullvoxpopuli/eslint-configs/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/nullvoxpopuli__eslint-configs` if it exists or add a new declaration (.d.ts) file containing `declare module '@nullvoxpopuli/eslint-configs';`ts(7016)

Which i think could not be a problem.

But in an an (in repo) addon i get the following lint rule warning. Which is weird cuase you package is published..?

  3:29  error  "@nullvoxpopuli/eslint-configs" is not published  n/no-unpublished-require
basz commented 10 months ago

note: after muting with / eslint-disable n/no-unpublished-require / in the addon(s) the error becomes the same warning as in the app... I don't undertstand why the difference exists between app vs addon though. It are v1 addons, but all lint config and setup seem the same... (also all packages are uptodate and insync between app and addons)

NullVoxPopuli commented 10 months ago

But in an an (in repo) addon i get the following lint rule warning. Which is weird cuase you package is published..?

Is the eslint accidentally getting published with your addon? It may help to une package.json#files instead of .npmignore

Could not find a declaration file for module '@nullvoxpopuli/eslint-configs'. '/Users/bas/Documents/Projects/BeautifullyPrintedMatter/Api-Application/nodemodules/.pnpm/@nullvoxpopuli+eslint-configs@3.2.2@babel+core@7.22.20_@babel+eslint-parser@7.22.15_eslint-c_eqnj277wc6jsd5gn5dqrwudc5i/node_modules/@nullvoxpopuli/eslint-configs/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/nullvoxpopuli__eslint-configs if it exists or add a new declaration (.d.ts) file containing declare module '@nullvoxpopuli/eslint-configs';ts(7016)

Is your TSconfig set up to check js?

But also, i should probably add types anyway

basz commented 10 months ago

no my app is private, however it did not have a private: true option in the package.json. Adding that removes the warning... thx!

regarding js check this is it my tsconfig.

{
  "extends": "@tsconfig/ember/tsconfig.json",
  "compilerOptions": {
    "skipLibCheck": true,
    "noEmitOnError": false,
    "baseUrl": ".",
    "paths": {
      "@beautifully-printer-matter/frontend/tests/*": ["tests/*"],
      "@beautifully-printer-matter/frontend/*": ["app/*"],
      "*": ["types/*"],
      "@plhw-lab/lab-tables/*": ["addon/*", "tests/*"]
    }
  },
  "include": ["addon/**/*", "tests/**/*", "types/**/*"],
  "glint": {
    "environment": ["ember-loose", "ember-template-imports"]
  }
}