Skip to content
Merged
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
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,27 @@ with TypeScript:

```js
const config = require('@silvermine/eslint-config'),
node = require('@silvermine/eslint-config/partials/node');
node = require('@silvermine/eslint-config/partials/node'),
typescript = require('@silvermine/eslint-config/partials/typescript');

module.exports = [
...config,
{
files: [ '**/*.ts' ],
...node
}
...typescript,
languageOptions: {
parserOptions: {
project: 'tsconfig.node.json',
},
},
...node,
},
];
```

Notice that we must specify the `project` property within `languageOptions.parserOptions`
to enable TypeScript strongly typed linting.

Below is how you would configure a browser library that uses only vanilla JS:

```js
Expand Down Expand Up @@ -108,7 +118,26 @@ module.exports = [

### Vue Support

Our default configuration supports Vue 3 by default.
Below is an example of using Vue 3 with TypeScript:

```js
const config = require('@silvermine/eslint-config'),
vue = require('@silvermine/eslint-config/partials/vue');

module.exports = [
...config,
{
files: [ '**/*.vue' ],
...vue,
languageOptions: {
parserOptions: {
project: 'tsconfig.web.json',
},
},
},
];
```


For legacy Vue.js 2.x projects, a Vue 2-specific configuration is available.
In this situation your project would be configured like so:
Expand Down
9 changes: 9 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable @typescript-eslint/triple-slash-reference */
/// <reference types="vite/client" />

declare module '*.vue' {
import { DefineComponent } from 'vue';
const component: DefineComponent<object, object, unknown>;

export default component;
}
8 changes: 8 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ const config = require('./index'),

module.exports = [
...config,
{
files: [ '**/*.ts' ],
languageOptions: {
parserOptions: {
project: [ './tsconfig.node.json' ],
},
},
},
{
...node,
},
Expand Down
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ module.exports = [
{
files: [ '**/*.ts' ],
...typescript,
languageOptions: {
...typescript.languageOptions,
parserOptions: {
...typescript.languageOptions.parserOptions,
project: [ './tsconfig.node.json' ],
},
},
},
{
files: [ '**/*.js', '**/*.cjs' ],
Expand All @@ -47,5 +54,13 @@ module.exports = [
...vueBaseRules,
...vue3rules,
},
languageOptions: {
...vueConfig.languageOptions,
parserOptions: {
...vueConfig.languageOptions.parserOptions,
project: [ './tsconfig.web.json' ],
extraFileExtensions: [ '.vue' ],
},
},
},
];
Loading