Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
bump version. support typescript imports and exports.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgarropy-atlassian committed Mar 29, 2023
1 parent 970caa4 commit a296c05
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 1,316 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
parserOptions: {
ecmaFeatures: {},
sourceType: "module",
project: "./tsconfig.json",
},
plugins: ["@typescript-eslint"],
parser: "@typescript-eslint/parser",
Expand Down
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Brad Garropy
Copyright (c) 2023 Brad Garropy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1,489 changes: 178 additions & 1,311 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bradgarropy/eslint-config-typescript",
"version": "1.0.4",
"version": "1.1.0",
"description": "🟦 typescript eslint configuration",
"keywords": [
"eslint",
Expand Down Expand Up @@ -29,14 +29,14 @@
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"typescript": "^4.1.2"
"typescript": "^5.0.2"
},
"devDependencies": {
"@types/react": "^18.0.21",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"react": "^18.2.0",
"typescript": "^4.1.2"
"typescript": "^5.0.2"
}
}
12 changes: 12 additions & 0 deletions rules/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ module.exports = {
ignoreRestSiblings: true,
},
],
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
disallowTypeAnnotations: true,
fixStyle: "separate-type-imports",
},
],
"@typescript-eslint/consistent-type-exports": [
"error",
{fixMixedExportsWithInlineTypeSpecifier: false},
],
},
},
],
Expand Down
3 changes: 2 additions & 1 deletion tests/component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FC} from "react"
import type {FC} from "react"

type ComponentProps = {
name: string
Expand All @@ -9,3 +9,4 @@ const Component: FC<ComponentProps> = ({name}) => {
}

export default Component
export type {ComponentProps}
11 changes: 11 additions & 0 deletions tests/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import type {Weather} from "./types"

const forecast: Weather = {
temperature: 68,
chanceOfRain: 2,
conditions: "clear",
}

console.log(forecast)

const hello = () => {
const subject = "world"
console.log(`Hello ${subject}!`)
Expand All @@ -9,3 +19,4 @@ const goodbye = () => {
}

hello()
goodbye()
7 changes: 7 additions & 0 deletions tests/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type Weather = {
temperature: number
chanceOfRain: number
conditions: string
}

export type {Weather}
20 changes: 20 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"allowJs": true,
"baseUrl": "src",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "es5"
},
"exclude": ["node_modules"],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
}

0 comments on commit a296c05

Please sign in to comment.