Skip to content

Commit

Permalink
Switch to flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime committed Dec 30, 2023
1 parent 93a4746 commit de054c7
Show file tree
Hide file tree
Showing 15 changed files with 236 additions and 184 deletions.
29 changes: 0 additions & 29 deletions .eslintrc.js

This file was deleted.

43 changes: 43 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

const { createFlatConfig } = require('@origin-1/eslint-config');
const eslintPluginEslintComments = require('eslint-plugin-eslint-comments');
const eslintPluginTsdoc = require('eslint-plugin-tsdoc');
const globals = require('globals');

module.exports =
createFlatConfig
(
{
ignores: ['**/.*', 'coverage', 'example/demo'],
},
{
files: ['**/*.js'],
jsVersion: 2020,
languageOptions: { sourceType: 'script' },
},
{
files: ['test/*.spec.js'],
languageOptions: { globals: globals.mocha },
},
{
files: ['**/*.ts'],
tsVersion: '4.2.0',
languageOptions: { parserOptions: { project: 'tsconfig.json' } },
plugins: { 'tsdoc': eslintPluginTsdoc },
rules: { 'tsdoc/syntax': 'error' },
},
{
languageOptions: { globals: globals.node },
plugins: { 'eslint-comments': eslintPluginEslintComments },
rules:
{
'no-throw-literal': 'off',
'eslint-comments/disable-enable-pair': 'error',
'eslint-comments/no-aggregating-enable': 'error',
'eslint-comments/no-duplicate-disable': 'error',
'eslint-comments/no-unlimited-disable': 'error',
'eslint-comments/no-unused-enable': 'error',
},
},
);
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ task
const gulpESLintNew = require('gulp-eslint-new');

const stream =
src(['.eslintrc.js', '*.js', 'example/*.js', 'lib/*.{js,ts}', 'test/**/*.{js,ts}'])
.pipe(gulpESLintNew({ warnIgnored: true }))
src(['*.js', 'example/*.js', 'lib/*.{js,ts}', 'test/**/*.{js,ts}'])
.pipe(gulpESLintNew({ configType: 'flat', warnIgnored: true }))
.pipe(gulpESLintNew.format('compact'))
.pipe(gulpESLintNew.failAfterError());
return stream;
Expand Down
Loading

0 comments on commit de054c7

Please sign in to comment.