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

typescript-eslint #29

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
node_modules
test
41 changes: 4 additions & 37 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,39 +1,6 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:import/recommended'],
overrides: [
{
files: ['**/*.test.js', 'test/**/*.js'],
env: {
// technically, we are using vitest, but that's pretty similar to jest
jest: true,
},
settings: {
'import/ignore': [
// for some reason, `import {it} from "vitest";` throws an error
/node_modules\/vitest\/dist\/index\.js$/.source,
],
},
},
],
parserOptions: {
sourceType: 'module',
},
rules: {
'import/no-cycle': 'error',
// make sure that all files have an extension (required by ESM)
'import/extensions': [
'error',
'always',
{
js: 'always',
jsx: 'never',
mjs: 'always',
},
],
},
Comment on lines -2 to -38
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of changing the file completely, like what you've done here, I'd prefer just adding the plugin:@typescript-eslint/recommended. I've also disabled the 'import/no-unresolved' rule since it doesn't seem to work, and TypeScript should check this for us anyway:

module.exports = {
  env: {
    browser: true,
    es2021: true,
    node: true,
  },
  extends: ['eslint:recommended', 'plugin:import/recommended', 'plugin:@typescript-eslint/recommended'],
  parser: '@typescript-eslint/parser',
  overrides: [
    {
      files: ['**/*.test.js', 'test/**/*.js'],
      env: {
        // technically, we are using vitest, but that's pretty similar to jest
        jest: true,
      },
      settings: {
        'import/ignore': [
          // for some reason, `import {it} from "vitest";` throws an error
          /node_modules\/vitest\/dist\/index\.js$/.source,
        ],
      },
    },
  ],
  parserOptions: {
    sourceType: 'module',
  },
  rules: {
    'import/no-cycle': 'error',
    'import/no-unresolved': 'off', // TypeScript's Node16 rule will check this for us
    // make sure that all files have an extension (required by ESM)
    'import/extensions': [
      'error',
      'always',
      {
        js: 'always',
        jsx: 'never',
        mjs: 'always',
      },
    ],
  },
};

extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
};
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
9 changes: 2 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci # throws an error if the package-lock.json file is out of sync
- name: Check for linting errors (run `npm run lint:fix` to fix)
run: npm run lint
- name: Check for prettier errors (run `npm run format` to fix)
run: npx prettier --check .
- run: npm ci
- name: Run unit tests
run: npm test
- name: Build the npm package to publish
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
node_modules
dist
.vscode
*.d.ts
*.tgz
Comment on lines -3 to -5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can understand removing .vscode, if you want to share your editor's config, but we probably want to still ignore *.d.ts and *.tgz files.

dist_tmp
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"esbenp.prettier-vscode",
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"editor.formatOnSave": true,
"editor.rulers": [
100
],
"search.exclude": {
"dist/**/*": true,
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
Loading