Skip to content

Commit

Permalink
Updates to work with ESLint 9
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaub committed Nov 18, 2024
1 parent 3a880f4 commit 492ae55
Show file tree
Hide file tree
Showing 18 changed files with 2,045 additions and 2,305 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
versioning-strategy: increase-if-necessary
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '22'
- run: npm ci
- run: npm test
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import react from './react.js';

export default [...react];
3 changes: 0 additions & 3 deletions examples/base/.eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions examples/base/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import base from '../../index.js';

export default [...base];
8 changes: 6 additions & 2 deletions examples/base/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import name from './dep.js';
import {readFile} from 'fs/promises';
import {dirname, join} from 'path';
import {fileURLToPath} from 'url';
import {readFile} from 'fs/promises';
import name from './dep.js';

const __dirname = dirname(fileURLToPath(import.meta.url));

/**
* @param {Array<string>} paths A list of paths.
* @return {Promise<Array<string>>} A promise for the content of the files.
*/
function main(paths) {
const promises = paths.map(async (name) => {
const data = await readFile(name);
Expand Down
3 changes: 0 additions & 3 deletions examples/react/.eslintrc

This file was deleted.

11 changes: 10 additions & 1 deletion examples/react/Message.js → examples/react/Message.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import React from 'react';
import {string} from 'prop-types';
import React from 'react';

/**
* @typedef {object} MessageProps
* @property {string} name The name.
*/

/**
* @param {MessageProps} props The props.
* @return {React.JSX.Element} The element.
*/
function Message({name}) {
return <div>Hello, {name}!</div>;
}
Expand Down
5 changes: 0 additions & 5 deletions examples/react/component.js

This file was deleted.

6 changes: 6 additions & 0 deletions examples/react/component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import {createRoot} from 'react-dom/client';
import Message from './Message.jsx';

const root = createRoot(document.getElementById('root'));
root.render(<Message name="John" />);
3 changes: 3 additions & 0 deletions examples/react/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import react from '../../react.js';

export default [...react];
119 changes: 0 additions & 119 deletions index.cjs

This file was deleted.

146 changes: 146 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import importPlugin from 'eslint-plugin-import';
import jsdoc from 'eslint-plugin-jsdoc';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';

export default [
importPlugin.flatConfigs.recommended,
jsdoc.configs['flat/recommended'],
eslintPluginPrettierRecommended,
{
languageOptions: {
globals: {
...globals.node,
...globals.browser,
},

ecmaVersion: 'latest',
sourceType: 'module',
},

settings: {
jsdoc: {
mode: 'typescript',
preferredTypes: {
'[]': 'Array<>',
'.<>': '<>',
},
tagNamePreference: {
returns: 'return',
file: 'fileoverview',
constant: 'const',
augments: 'extends',
},
},
},

rules: {
'block-scoped-var': 'error',
'curly': 'error',
'default-case': 'error',
'import/no-unresolved': [
'error',
{
commonjs: true,
},
],
'import/order': [
'error',
{
named: true,
alphabetize: {
order: 'asc',
},
},
],
'import/no-duplicates': 'error',
'import/named': 'error',
'import/default': 'error',
'import/extensions': [
'error',
'always',
{
ignorePackages: true,
},
],
'jsdoc/check-access': 'error',
'jsdoc/check-alignment': 'error',
'jsdoc/check-param-names': 'error',
'jsdoc/check-property-names': 'error',
'jsdoc/check-syntax': 'error',
'jsdoc/check-tag-names': [
'error',
{
definedTags: ['api', 'observable'],
},
],
'jsdoc/check-types': 'error',
'jsdoc/empty-tags': 'error',
'jsdoc/implements-on-classes': 'error',
'jsdoc/no-bad-blocks': 'error',
'jsdoc/require-hyphen-before-param-description': ['error', 'never'],
'jsdoc/require-param': 'error',
'jsdoc/require-param-description': 'error',
'jsdoc/require-param-name': 'error',
'jsdoc/require-param-type': 'error',
'jsdoc/require-property': 'error',
'jsdoc/require-property-description': 'error',
'jsdoc/require-property-name': 'error',
'jsdoc/require-property-type': 'error',
'jsdoc/require-returns': 'error',
'jsdoc/require-returns-check': 'error',
'jsdoc/require-returns-description': 'error',
'jsdoc/require-returns-type': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-const-assign': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-class-members': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'error',
'no-empty-character-class': 'error',
'no-eq-null': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-inner-declarations': ['error', 'functions'],
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-multi-assign': 'error',
'no-negated-in-lhs': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-sparse-arrays': 'error',
'no-this-before-super': 'error',
'no-undef': 'error',
'no-unreachable': 'error',
'no-unused-vars': [
'error',
{
vars: 'all',
args: 'none',
},
],
'no-use-before-define': ['error', 'nofunc'],
'no-var': 'error',
'prefer-const': 'error',
'prettier/prettier': [
'error',
{
singleQuote: true,
bracketSpacing: false,
quoteProps: 'preserve',
},
],
'use-isnan': 'error',
'valid-typeof': 'error',
},
},
];
Loading

0 comments on commit 492ae55

Please sign in to comment.