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

TypeError raised on new projects #46

Closed
stevepolitodesign opened this issue Dec 8, 2023 · 2 comments
Closed

TypeError raised on new projects #46

stevepolitodesign opened this issue Dec 8, 2023 · 2 comments

Comments

@stevepolitodesign
Copy link

stevepolitodesign commented Dec 8, 2023

Node Version: v21.4.0
Yarn Version: v1.22.17
NPM Version: 10.2.4


Steps to reproduce:

  1. Run mkdir stylelint && cd stylelint.

  2. Run yarn init and follow prompts.

  3. Run npm init stylelint

  4. Run touch index.css

  5. Run npx stylelint "**/*.css". Note the output:

     index.css
     1:1  ✖  Unexpected empty source  no-empty-source
    
    1 problem (1 error, 0 warnings)
    
  6. Run yarn add @thoughtbot/stylelint-config --dev

  7. Update .stylelintrc.json.

    { "extends": ["@thoughtbot/stylelint-config"] }
  8. Run npx stylelint "**/*.css". Note the output:

    ❯ npx stylelint "**/*.css"
    TypeError: Cannot read properties of undefined (reading 'rejected')
        at Object.<anonymous> (/Users/polito/Sites/playground/stylelint/node_modules/stylelint-scss/src/rules/comment-no-    empty/index.js:12:42)
        at Module._compile (node:internal/modules/cjs/loader:1376:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
        at Module.load (node:internal/modules/cjs/loader:1207:32)
        at Module._load (node:internal/modules/cjs/loader:1023:12)
        at Module.require (node:internal/modules/cjs/loader:1235:19)
        at require (node:internal/modules/helpers:176:18)
        at Object.<anonymous> (/Users/polito/Sites/playground/stylelint/node_modules/stylelint-scss/src/rules/index.js:31:23)
        at Module._compile (node:internal/modules/cjs/loader:1376:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    

stevepolitodesign added a commit to thoughtbot/suspenders that referenced this issue Dec 11, 2023
In an effort to account for this [issue][], we pin `stylelint` and
`@thoughtbot/stylelint-config` to specific versions.

Unfortunately, we still see deprecation warnings.

[issue]: thoughtbot/stylelint-config#46
stevepolitodesign added a commit to thoughtbot/suspenders that referenced this issue Dec 11, 2023
Closes #1107
Closes #1143

Creates a holistic linting solution that covers JavaScript, CSS, Ruby
and ERB.

Introduces [scripts][] that leverage [@thoughtbot/eslint-config][],
[@thoughtbot/stylelint-config][] and [prettier][].

Also introduces `.prettierrc` based off of our [Guides][].

We need to pin `stylelint` and `@thoughtbot/stlyelint-config` to
specific versions to account for this [open issue][]. Unfortunately,
running `yarn run lint:stylelint` results in deprecation warnings, which
will need to be addressed separately.

[scripts]: https://docs.npmjs.com/cli/v6/using-npm/scripts
[@thoughtbot/eslint-config]: https://github.com/thoughtbot/eslint-config
[@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config
[prettier]: https://prettier.io
[Guides]: https://github.com/thoughtbot/guides/blob/main/javascript/README.md#formatting
[open issue]: thoughtbot/stylelint-config#46

Introduces `rake standard` which also runs `erblint` to lint ERB files
via [better_html][], [erb_lint][] and [erblint-github][].

[better_html]: https://github.com/Shopify/better-html
[erb_lint]: https://github.com/Shopify/erb-lint
[erblint-github]: https://github.com/github/erblint-github

A future commit will ensure these linting rules are run during CI. In an
effort to support that future commit, we ensure to run `yarn run
fix:prettier` and `bundle exec standard:fix_unsafely` once the generator
is complete. Otherwise, CI would fail because of linting violations.

We call `standard:fix_unsafely` since `standard:fix` returns an error
status code on new Rails applications. Running `standard:fix_unsafely`
fixes this issue and returns a success status code.

It should be noted that we deliberately permit this generator to be
invoked on API only applications, because those applications can still
contain views, like ones used for mailers.

Also improves the developer experience by introducing `with_test_suite`
helper, allowing the caller to run the generator in an application using
minitest or RSpec.
stevepolitodesign added a commit to thoughtbot/suspenders that referenced this issue Dec 11, 2023
Closes #1107
Closes #1143

Creates a holistic linting solution that covers JavaScript, CSS, Ruby
and ERB.

Introduces [scripts][] that leverage [@thoughtbot/eslint-config][],
[@thoughtbot/stylelint-config][] and [prettier][].

Also introduces `.prettierrc` based off of our [Guides][].

We need to pin `stylelint` and `@thoughtbot/stlyelint-config` to
specific versions to account for this [open issue][]. Unfortunately,
running `yarn run lint:stylelint` results in deprecation warnings, which
will need to be addressed separately.

[scripts]: https://docs.npmjs.com/cli/v6/using-npm/scripts
[@thoughtbot/eslint-config]: https://github.com/thoughtbot/eslint-config
[@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config
[prettier]: https://prettier.io
[Guides]: https://github.com/thoughtbot/guides/blob/main/javascript/README.md#formatting
[open issue]: thoughtbot/stylelint-config#46

Introduces `rake standard` which also runs `erblint` to lint ERB files
via [better_html][], [erb_lint][] and [erblint-github][].

[better_html]: https://github.com/Shopify/better-html
[erb_lint]: https://github.com/Shopify/erb-lint
[erblint-github]: https://github.com/github/erblint-github

A future commit will ensure these linting rules are run during CI. In an
effort to support that future commit, we ensure to run `yarn run
fix:prettier` and `bundle exec standard:fix_unsafely` once the generator
is complete. Otherwise, CI would fail because of linting violations.

We call `standard:fix_unsafely` since `standard:fix` returns an error
status code on new Rails applications. Running `standard:fix_unsafely`
fixes this issue and returns a success status code.

It should be noted that we deliberately permit this generator to be
invoked on API only applications, because those applications can still
contain views, like ones used for mailers. However, a future commit could
explore removing the JavaScript linters.

Also improves the developer experience by introducing `with_test_suite`
helper, allowing the caller to run the generator in an application using
minitest or RSpec.
@nickcharlton
Copy link
Member

@stevepolitodesign, could you give v4.0.0 a go when you get a chance? I've updated a lot this project over the last few days which should mean it's working again well.

@stevepolitodesign
Copy link
Author

@nickcharlton just tested again, and everything works as expected!

stevepolitodesign added a commit to thoughtbot/suspenders that referenced this issue Mar 1, 2024
After the `v4.0.0` release of [@thoughtbot/stylelint-config][], the
errors mentioned in [this issue][] no longer appear.

This alleviates us from having to pin these dependencies.

[@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config/releases/tag/v4.0.0
[this issue]: thoughtbot/stylelint-config#46
stevepolitodesign added a commit to thoughtbot/suspenders that referenced this issue Mar 1, 2024
After the `v4.0.0` release of [@thoughtbot/stylelint-config][], the
errors mentioned in [this issue][] no longer appear.

This alleviates us from having to pin these dependencies.

[@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config/releases/tag/v4.0.0
[this issue]: thoughtbot/stylelint-config#46
stevepolitodesign added a commit to thoughtbot/suspenders that referenced this issue May 10, 2024
Closes #1107
Closes #1143

Creates a holistic linting solution that covers JavaScript, CSS, Ruby
and ERB.

Introduces [scripts][] that leverage [@thoughtbot/eslint-config][],
[@thoughtbot/stylelint-config][] and [prettier][].

Also introduces `.prettierrc` based off of our [Guides][].

We need to pin `stylelint` and `@thoughtbot/stlyelint-config` to
specific versions to account for this [open issue][]. Unfortunately,
running `yarn run lint:stylelint` results in deprecation warnings, which
will need to be addressed separately.

[scripts]: https://docs.npmjs.com/cli/v6/using-npm/scripts
[@thoughtbot/eslint-config]: https://github.com/thoughtbot/eslint-config
[@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config
[prettier]: https://prettier.io
[Guides]: https://github.com/thoughtbot/guides/blob/main/javascript/README.md#formatting
[open issue]: thoughtbot/stylelint-config#46

Introduces `rake standard` which also runs `erblint` to lint ERB files
via [better_html][], [erb_lint][] and [erblint-github][].

[better_html]: https://github.com/Shopify/better-html
[erb_lint]: https://github.com/Shopify/erb-lint
[erblint-github]: https://github.com/github/erblint-github

A future commit will ensure these linting rules are run during CI. In an
effort to support that future commit, we ensure to run `yarn run
fix:prettier` and `bundle exec standard:fix_unsafely` once the generator
is complete. Otherwise, CI would fail because of linting violations.

We call `standard:fix_unsafely` since `standard:fix` returns an error
status code on new Rails applications. Running `standard:fix_unsafely`
fixes this issue and returns a success status code.

It should be noted that we deliberately permit this generator to be
invoked on API only applications, because those applications can still
contain views, like ones used for mailers. However, a future commit could
explore removing the JavaScript linters.

Also improves the developer experience by introducing `with_test_suite`
helper, allowing the caller to run the generator in an application using
minitest or RSpec.
stevepolitodesign added a commit to thoughtbot/suspenders that referenced this issue May 10, 2024
After the `v4.0.0` release of [@thoughtbot/stylelint-config][], the
errors mentioned in [this issue][] no longer appear.

This alleviates us from having to pin these dependencies.

[@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config/releases/tag/v4.0.0
[this issue]: thoughtbot/stylelint-config#46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants