-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #732 from davidtaylorhq/eslint9-support
Add support for eslint 9
- Loading branch information
Showing
18 changed files
with
239 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'eslint-plugin-decorator-position': major | ||
--- | ||
|
||
Adds support for ESLint 9 with flat configs, and drops ESLint 6 compatibility. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const { resolve } = require('path'); | ||
|
||
// Eslint v8+ does not have CLIEngine. | ||
const { CLIEngine: v7AndEarlier } = require('eslint'); | ||
|
||
const isEslint7 = Boolean(v7AndEarlier); | ||
|
||
const esLint7Config = { | ||
root: true, | ||
|
||
parser: 'babel-eslint', | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
legacyDecorators: true, | ||
}, | ||
}, | ||
|
||
env: { | ||
browser: true, | ||
es6: true, | ||
}, | ||
|
||
plugins: ['decorator-position'], | ||
}; | ||
|
||
const esLint8Config = { | ||
root: true, | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
legacyDecorators: true, | ||
}, | ||
babelOptions: { | ||
configFile: resolve(__dirname, '../../babel.config.cjs'), | ||
}, | ||
}, | ||
|
||
env: { | ||
browser: true, | ||
es6: true, | ||
}, | ||
|
||
plugins: ['decorator-position'], | ||
}; | ||
|
||
module.exports = isEslint7 ? esLint7Config : esLint8Config; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,9 @@ | ||
const { resolve } = require('path'); | ||
const DecoratorPosition = require('../index'); | ||
|
||
// Eslint v8+ does not have CLIEngine. | ||
const { CLIEngine: v7AndEarlier } = require('eslint'); | ||
|
||
const isEslint7 = Boolean(v7AndEarlier); | ||
|
||
const esLint7Config = { | ||
root: true, | ||
|
||
parser: 'babel-eslint', | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
legacyDecorators: true, | ||
}, | ||
}, | ||
|
||
env: { | ||
browser: true, | ||
es6: true, | ||
}, | ||
|
||
plugins: ['decorator-position'], | ||
}; | ||
|
||
const esLint8Config = { | ||
root: true, | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
legacyDecorators: true, | ||
}, | ||
babelOptions: { | ||
configFile: resolve(__dirname, '../../babel.config.cjs'), | ||
module.exports = [ | ||
{ | ||
plugins: { | ||
'decorator-position': DecoratorPosition, | ||
}, | ||
}, | ||
|
||
env: { | ||
browser: true, | ||
es6: true, | ||
}, | ||
|
||
plugins: ['decorator-position'], | ||
}; | ||
|
||
module.exports = isEslint7 ? esLint7Config : esLint8Config; | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = [...require('./base'), ...require('./rules')]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = [ | ||
{ | ||
rules: { | ||
'decorator-position/decorator-position': ['error', {}], | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export class Foo { | ||
@attr title; | ||
|
||
@belongsTo('user') author; | ||
@hasMany('comments') comments; | ||
|
||
@tracked uninitialized; | ||
@tracked initialized = 2; | ||
|
||
|
||
@foo | ||
get myMethod() { | ||
|
||
} | ||
|
||
@foo | ||
myMethod2() { | ||
|
||
} | ||
|
||
@foo | ||
async myMethod3() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = [ | ||
{ | ||
languageOptions: { | ||
parser: require('@babel/eslint-parser'), | ||
parserOptions: { | ||
requireConfigFile: false, | ||
babelOptions: { | ||
plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]], | ||
}, | ||
}, | ||
}, | ||
}, | ||
...require('eslint-plugin-decorator-position/config/recommended'), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "test", | ||
"version": "0.0.0", | ||
"description": "smoke-test", | ||
"license": "MIT", | ||
"private": true, | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"babel-eslint": "^10.0.3", | ||
"eslint-plugin-decorator-position": "*", | ||
"eslint": "^9.0.0" | ||
} | ||
} |
Oops, something went wrong.