Skip to content

Commit

Permalink
feat: add an ie11 ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Aug 11, 2022
1 parent 56f76b3 commit 1f09a8e
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 15 deletions.
3 changes: 3 additions & 0 deletions packages/eslint-config-airbnb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ module.exports = {
```

`createAliasSetting` accepts a map of aliases and their corresponding paths, and returns a settings object to be spread in to the `settings` field of the ESLint config.

## IE 11 support

24 changes: 24 additions & 0 deletions packages/eslint-config-airbnb/ie11.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
parser: require.resolve('vue-eslint-parser'),
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
plugins: ['react', 'vue'],

rules: {
// Disallow target="_blank" on links
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
'react/jsx-no-target-blank': ['error', {
allowReferrer: false,
enforceDynamicLinks: 'always',
}],

// https://eslint.vuejs.org/rules/no-template-target-blank.html
'vue/no-template-target-blank': ['error', {
allowReferrer: false,
enforceDynamicLinks: 'always',
}],
},
};
6 changes: 3 additions & 3 deletions packages/eslint-config-airbnb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"main": "index.js",
"exports": {
".": "./index.js",
"./ie11": "./ie11.js",
"./createAliasSetting": "./createAliasSetting.js",
"./package.json": "./package.json",

"./rules/imports": "./rules/imports.js"
},
"publishConfig": {
Expand Down Expand Up @@ -47,7 +47,7 @@
"eslint-plugin-vue": "^9.2.0"
},
"devDependencies": {
"eslint": "^8.2.0",
"eslint-plugin-vue": "^9.2.0"
"eslint": "^8.21.0",
"eslint-plugin-vue": "^9.3.0"
}
}
6 changes: 3 additions & 3 deletions packages/eslint-config-airbnb/rules/jsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ module.exports = {
// Disallow target="_blank" on links
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
'react/jsx-no-target-blank': ['error', {
// TODO: (semver-minor)
// default to true once Vue 2 reaches EOL (so that IE support is dropped)
allowReferrer: false,
// Unllike in the `airbnb-base` ruleset, this is set to `true`,
// Because neither Vue CLI & Vite targets IE 11 by default.
allowReferrer: true,

enforceDynamicLinks: 'always',
}],
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-config-airbnb/rules/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ module.exports = {

// https://eslint.vuejs.org/rules/no-template-target-blank.html
'vue/no-template-target-blank': ['error', {
// TODO: (semver-minor)
// default to true once Vue 2 reaches EOL (so that IE support is dropped)
allowReferrer: false,
// Unllike in the `airbnb-base` ruleset, this is set to `true`,
// Because neither Vue CLI & Vite targets IE 11 by default.
allowReferrer: true,

enforceDynamicLinks: 'always',
}],
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-aribnb-with-typescript/ie11.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@vue/eslint-config-airbnb/ie11');
13 changes: 7 additions & 6 deletions packages/eslint-config-aribnb-with-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "index.js",
"exports": {
".": "./index.js",
"./ie11": "./ie11.js",
"./allow-js-in-vue": "./allow-js-in-vue.js",
"./allow-tsx-in-vue": "./allow-tsx-in-vue.js",
"./allow-jsx-in-vue": "./allow-jsx-in-vue.js",
Expand Down Expand Up @@ -32,13 +33,13 @@
},
"homepage": "https://github.com/vuejs/eslint-config-airbnb/blob/main/packages/eslint-config-airbnb-with-typescript#readme",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"@vue/eslint-config-airbnb": "workspace:^",
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-define-config": "^1.5.1",
"eslint-define-config": "^1.6.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^3.3.0",
"eslint-import-resolver-typescript": "^3.4.0",
"eslint-plugin-import": "^2.26.0",
"vue-eslint-parser": "^9.0.3"
},
Expand All @@ -48,8 +49,8 @@
"typescript": "*"
},
"devDependencies": {
"eslint": "^8.2.0",
"eslint-plugin-vue": "^9.2.0",
"eslint": "^8.21.0",
"eslint-plugin-vue": "^9.3.0",
"typescript": "~4.7.4"
},
"eslintConfig": {
Expand Down

0 comments on commit 1f09a8e

Please sign in to comment.