Skip to content

Commit

Permalink
feat: migrate to ESLint 9 and flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Oct 8, 2024
1 parent 732d160 commit 4ff7efc
Show file tree
Hide file tree
Showing 18 changed files with 3,104 additions and 911 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:

strategy:
matrix:
node-version: [ 14, 16 ]
eslint: [ 7, '' ]
node-version: [ 18, 20, 22 ]
eslint: [ 9, '' ]

steps:
- name: Checkout
Expand Down
22 changes: 14 additions & 8 deletions configs/apache.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
const path = require('path');
import licenseHeaderPlugin from 'eslint-plugin-license-header';

module.exports = {
plugins: [
'license-header'
],
rules: {
'license-header/header': [2, path.join(__dirname, '/../resources/apache-license-header.js') ]
import { fileURLToPath } from 'node:url';

const path = fileURLToPath(new URL('../resources/apache-license-header.txt', import.meta.url));

export default [
{
plugins: {
'license-header': licenseHeaderPlugin
},
rules: {
'license-header/header': [2, path]
}
}
};
]
22 changes: 14 additions & 8 deletions configs/commercial.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
const path = require('path');
import licenseHeaderPlugin from 'eslint-plugin-license-header';

module.exports = {
plugins: [
'license-header'
],
rules: {
'license-header/header': [2, path.join(__dirname, '/../resources/commercial-license-header.js') ]
import { fileURLToPath } from 'node:url';

const path = fileURLToPath(new URL('../resources/commercial-license-header.txt', import.meta.url));

export default [
{
plugins: {
'license-header': licenseHeaderPlugin
},
rules: {
'license-header/header': [2, path]
}
}
};
]
22 changes: 14 additions & 8 deletions configs/mit.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
const path = require('path');
import licenseHeaderPlugin from 'eslint-plugin-license-header';

module.exports = {
plugins: [
'license-header'
],
rules: {
'license-header/header': [2, path.join(__dirname, '/../resources/MIT-license-header.js') ]
import { fileURLToPath } from 'node:url';

const path = fileURLToPath(new URL('../resources/MIT-license-header.txt', import.meta.url));

export default [
{
plugins: {
'license-header': licenseHeaderPlugin
},
rules: {
'license-header/header': [2, path]
}
}
};
]
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use strict';
import mit from './configs/mit.js';
import commercial from './configs/commercial.js';
import apache from './configs/apache.js';

var mit = require('./configs/mit');
var commercial = require('./configs/commercial');
var apache = require('./configs/apache');

module.exports = {
export default {
configs: {
mit,
MIT: mit,
Expand Down
Loading

0 comments on commit 4ff7efc

Please sign in to comment.